Re: [osg-users] Opposing techniques for rendering a reflective floor

2008-10-22 Thread Alexander Löffler

Hi David,

David Spilling wrote:
Note that doing (1) doesn't preclude RTT - e.g. you can RTT the whole 
inverted scene to a texture and then generate appropriate texcoords on 
the mirror, either by hand since your camera is fixed, or in a shader.


Plus I'm not sure why you think that (1) is quite a few additional 
render passes. Obviously with RTT it's only one more pass - the 
inverted scene - but without RTT, and with a stencil buffer, you only 
have to draw (a) the mirror, with stencil buffer set, (b) the inverted 
scene respecting the stencil buffer, (c) the rest of the scene without 
the mirror. Good control of your renderbins makes this fairly easy.


Additional issues with (1) might include the fact that you have to 
manage the lighting (i.e. you have to invert the scene lighting as well, 
otherwise it looks pretty odd). Also, an unlikely but possible issues is 
that If you have some special requirements for poly winding - e.g. 
models with special shaders - note that if you just mirror the scene, 
all the winding inverts as well.


FWIW, I would do either technique as RTT, as then effects like blur, or 
mirror surface non uniformity, or things like this become a lot easier  
(in GLSL).


Given theat, I'm not sure I have a strong favorite. I guess I'd do (2) 
since your camera(s) are fixed; you need a new camera to do RTT anyway 
so setting it up inverted is easy. The only reason I might not is if I 
want to play with complex camera settings later which might be a pain to 
implement e.g. stereo, strange projections, etc.


Rendering performance should be near identical (assuming RTT for both).


thank you for this insight, it really helped a lot. I am using RTT with 
a duplicate inverted camera now, as this seems easiest for the simple 
effects I want to achieve. Currently, I am struggling with texture 
coordinates and placement and masking of cameras in my scenegraph to 
avoid introducing infinite recursion. Solving this will be just a matter 
of time, though. ;)


Thanks again,
Alex.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Opposing techniques for rendering a reflective floor

2008-10-21 Thread Alexander Löffler
Hi,

I am trying to render a reflective floor below my scene. There are things moving
and sometimes poking through the floor as well, but the position of floor and
camera are fixed in relation to each other, so there is no way to ever look
below the mirroring surface.

On doing some research, I found two quite contrary techniques for realizing this
kind of effect:

(1) Duplicate scene (as in the osgreflect example)

The scene is rendered a second time below the surface, the main camera looks
through the reflective surface. Attention must be paid on what could be visible
of the reflected scene, and clipped away appropriately.

(2) Duplicate camera with Render-to-Texture

The scene exists only once, but a second, reflected camera is introduced that
looks from below the surface to the scene and renders it to a texture which is
then projected onto the reflective surface.

The way I see it, the main advantage of (1) would be reflections in the full
rendering resolution, which are paid for by quite a few additional render
passes. The advantage of (2) is that I used RTT before ;), and it seems to be
better scalable (by adjusting the size of the created texture). The primary
focus of my application is interactive performance, and only secondary a maximum
quality of the reflection, which might, for example, be implemented blurred in
later development.

Can anyone further comment on the two opposing techniques, especially in terms
of rendering performance, easy implementation in OSG and in what cases best to
use the one or the other?

Thanks a lot,
Alex.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Opposing techniques for rendering a reflective floor

2008-10-21 Thread David Spilling
Hi Alex,

Note that doing (1) doesn't preclude RTT - e.g. you can RTT the whole
inverted scene to a texture and then generate appropriate texcoords on the
mirror, either by hand since your camera is fixed, or in a shader.

Plus I'm not sure why you think that (1) is quite a few additional render
passes. Obviously with RTT it's only one more pass - the inverted scene -
but without RTT, and with a stencil buffer, you only have to draw (a) the
mirror, with stencil buffer set, (b) the inverted scene respecting the
stencil buffer, (c) the rest of the scene without the mirror. Good control
of your renderbins makes this fairly easy.

Additional issues with (1) might include the fact that you have to manage
the lighting (i.e. you have to invert the scene lighting as well, otherwise
it looks pretty odd). Also, an unlikely but possible issues is that If you
have some special requirements for poly winding - e.g. models with special
shaders - note that if you just mirror the scene, all the winding inverts as
well.

FWIW, I would do either technique as RTT, as then effects like blur, or
mirror surface non uniformity, or things like this become a lot easier  (in
GLSL).

Given theat, I'm not sure I have a strong favorite. I guess I'd do (2) since
your camera(s) are fixed; you need a new camera to do RTT anyway so setting
it up inverted is easy. The only reason I might not is if I want to play
with complex camera settings later which might be a pain to implement e.g.
stereo, strange projections, etc.

Rendering performance should be near identical (assuming RTT for both).

Hope that helps,

David
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org