Simply switching off the z buffer test would be too simplistic, as it would
not indicate visually if the object is unobstructed, partially obstructed
or not obstructed at all.

But thank you for the hint to use the stencil buffer. This may be a decent
way to move forward. Combining this with multiple render bins (passes)
might allow me to get the desired effect.

Christian


2014-12-02 14:58 GMT+01:00 Robert Osfield <[email protected]>:

> Hi Christian,
>
> On 2 December 2014 at 13:04, Christian Buchner <
> [email protected]> wrote:
>
>> our client wants me to have some obscured 3D objects visible even if
>> there's e.g. a building in front of it.  Order independent transparency
>> rendering techniques such as depth peeling are too costly when it involves
>> a city model with hundreds of buildings.
>>
>> So I was thinking to simply change the rendering style whenever the
>> fragment of my obscured object would not pass the depth test.
>>
>> But I have no idea how one would implement a depth test in the fragment
>> shader and adapt the rendering style based on its outcome. Is it really
>> necessary to first render the entire scene into an FBO with a texture
>> attached as a depth buffer so that you can sample this depth texture later?
>> This seems extremely costly to me, as it would involve another full
>> geometry pass.
>>
>> Are there any osg examples that access the depth buffer from a shader?
>>
>
> As far as I'm aware your can't read the depth buffer from any of the
> shaders.
>
> What you can do instead is use a multi-pass approach where you render the
> scene to a depth and colour texture and then read both in the shader during
> a second pass.  The second pass needn't render the whole scene, but could
> if this is what you wanted - typically you'd just render a screen aligned
> quad to fill in the final colour and depth buffers from the texture and
> then do any extra's you want.
>
> In your case you probably don't need to play tricks with shaders.  You
> could render the scene without the objects of interests as normal, then in
> a second pass clear the depth buffer then render the objects that you want
> to force on top.   Another technique would be to use the stencil buffer.
>
> Robert.
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to