Thanks for the info. I'll try to do as you suggested.

Can anyone please check if my conclusions are correct in the shader
comments?
The 1st and 2nd pass shaders are right at the top:
https://bitbucket.org/kornerr/osg-deferred-shading/src/9a2bb7f2c800f3f3d4632ba4fcc27549aa4b7967/main.cpp?at=default

Thanks.

PS: Also, I'd like to know how to correctly name the posDir_worldspace
vector, since position direction doesn't make much sense.


2013/10/5 Marcel Pursche <marcel.purs...@student.hpi.uni-potsdam.de>

> Hello,
>
> I can't give you a example code but a general concept.
> The most commonly used technique to create shadows nowadays is shadow
> mapping. The basic idea is to render in a depth buffer from the light
> source looking to the scene. The projection and model view matrix, that was
> used to generate this image, needs to be passed to the main render pass
> as-well. In the main render pass the vertex position is multiplied with the
> light projection and model view matrix to get the position of this vertex
> in the depth buffer. The only thing that needs to be done to create shadows
> is to compare the depth value stored in the depth buffer with the z-value
> of our vertex. If the stored value was bigger, there is no shadow, if the
> value was smaller, the fragment is shadowed.
>
> To combine this technique with deferred shading is pretty simple. You can
> just create a post render pass with the position buffer from the deferred
> pipeline and the depth image as input. Instead of the vertex position you
> just need to use the position stored in the position buffer as input.
> Everything else stays the same.
>
> You can look in the osgShadow source code to see how you can set up the
> prerender camera and how the shader code should look like.
>
>
> Thank you!
>
> Cheers,
> Marcel
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=56626#56626
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to