Author Topic: wireframe mode per object/mesh  (Read 6493 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
wireframe mode per object/mesh
« on: September 29, 2007, 07:52:24 pm »
hello,

is it possible to add support for rendering only some objects in wireframe mode ? it may be great for special effects or for helpers like grids, trajectories etc. it may even be greater if such a mode supports optionally not rendering hidden vertices/edges (just like a regular render)

i guess this can be emulated by making all other objects invisible and rendering in wireframe mode to same framebuffer but this emulation ignores hidden status vertices/edges

thanks,
r a f t

Offline Klaudiusz

  • int
  • **
  • Posts: 75
    • View Profile
Re: wireframe mode per object/mesh
« Reply #1 on: September 29, 2007, 08:21:33 pm »
I think, everything what You can do is to make a differend World for wireframed objects. You need to disable Curling if You want to show hidden lines. Wireframe drawing should use Z-Buffer. If so, just render the secound World as wireframe after the main World- than if Your object is covered by other - won't be drawn (z-buffer walue will  be bigger). It's a little complicated, but drawWireframe is a World method only.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: wireframe mode per object/mesh
« Reply #2 on: September 29, 2007, 08:47:47 pm »
Wireframe drawing should use Z-Buffer.
not really. i dont know the technical details but wireframe mode doesnt take hidden surfaces into account. just run the fps demo and toggle wireframe mode. you will see walls behind others are rendered too.

You need to disable Curling if You want to show hidden lines.
culling is something different. it's not for showing/hiding hidden polygons but showing/hiding polygons facing other side. normally a simple plane which looks in the direction of camera (its normal vector is in camera direction's semi-space) wont be rendered as it faces other side. if you disable culling on that plane it will be rendered regardless of wherever it's facing. of course it can be hidden by another object but it's another story..

..what You can do is to make a differend World for wireframed objects.
you are right about that, that's another way of that emulation. instead of making other objects invisible one can put a copy of wireframed objects into another world

r a f t

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: wireframe mode per object/mesh
« Reply #3 on: October 01, 2007, 07:26:39 am »
I'm not sure how well this fits into the pipeline. I'll look into it, when i find the time.

Offline stormp

  • byte
  • *
  • Posts: 38
    • View Profile
Re: wireframe mode per object/mesh
« Reply #4 on: October 28, 2007, 07:12:56 am »
I'd love this feature too :-D

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: wireframe mode per object/mesh
« Reply #5 on: August 14, 2008, 04:51:52 pm »
I am interested in this too. How to render just some objetc in wireframe mode or in a combinated mode. Maybe rendering it as normal and then overwritting the buffer with the wireframe render and then displaying it. ANy way to do it?
Nada por ahora

Offline LeoMaheo

  • byte
  • *
  • Posts: 10
    • View Profile
Re: wireframe mode per object/mesh
« Reply #6 on: April 04, 2009, 09:21:17 pm »
I'm also interested in rendering only some objects in wireframe.

The reason is I want to draw X recent postures of a ragdoll,
to simplify debugging of ragdoll-walking-code.
I believe I'd rather draw these postures in wireframes
(otherwise they tend to overlap and hide each other and other graphics).

( I'm a bit surprised there's a public function
Code: [Select]
IRenderer.drawWireframe(VisList visList, int ind, int color, FrameBuffer buffer) but no way to obtain the relevant IRenderer instance ?? )

( Perhaps I should use the line-drawing-code provided in "createLine3D" here:
http://www.jpct.net/forum2/index.php/topic,1091.0.html
and draw a box-of-lines. )

(I hope you don't mind me waking this old thread :-)  )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: wireframe mode per object/mesh
« Reply #7 on: April 05, 2009, 12:15:22 am »
The method in the IRenderer interface wouldn't help, because it refers to the visibility list, not to a single object. With the default pipeline, wireframe per object just isn't possible in a reasonable way at render time. With the compiled pipeline in the 1.18 beta, it should be possible somehow if the object has been compiled.
Something that will work for both (but is a bit ugly), is to render the World twice. Once in normal mode with all objects visible. Then, iterate through all world objects, store their visibility, set them to invisible except for the ones that you want to render in wireframe, render the world again and draw it in wireframe, reset all world objects to the correct visibility. It's ugly, but once wrapped into a small method that will take care of these steps, it should be pretty easy to use...it won't be very fast, but it should be sufficient for debugging purposes.

Offline LeoMaheo

  • byte
  • *
  • Posts: 10
    • View Profile
Re: wireframe mode per object/mesh
« Reply #8 on: April 05, 2009, 04:52:15 am »
Something that will work for both (but is a bit ugly), is to render the World twice. Once in normal mode with all objects visible.
Then, iterate through all world objects, store their visibility,
set them to invisible except for the ones that you want to render in wireframe,
render the world again and draw it in wireframe,
reset all world objects to the correct visibility.

I did that, works fine (although wireframes are rendered on top of everything else), thanks.