Hello Christoph,

On 09/14/2012 04:40 AM, "Christoph Fünfzig" wrote:
> Ok, this sounds good.
> I use a vertex shader, which repositions vertices. It needs to be activated 
> during shadow map generation to get correct shadows.
>
> Please see here:
> Image with just a quad (as Geometry)
> http://dl.dropbox.com/u/15967626/shadow_without.png
>
> Image with terrain nodes (10*10 tiles) with vertex shader to reposition 
> vertices acc. to a float texture
> http://dl.dropbox.com/u/15967626/shadow_terrain1.png
>
> Image with terrain nodes (10*10 tiles) with vertex shader deactivated
> http://dl.dropbox.com/u/15967626/shadow_terrain2.png
>
> As you can see, shadows from the single point light with quad geometry looks 
> correct.
> With the terrain, the shadow looks like the vertex shader having been 
> deactivated during shadow generation.
> The terrain tile node is derived from OSG::MaterialDrawable having a 
> OSG::SimpleMaterial and a OSG::SimpleSHLChunk setting the shader parameters.
> So are there restrictions on the materials?

ah, somehow when you mentioned shaders, I had not recalled that the 
shadow stage overrides the material when creating the shadow maps. The 
reason is that you basically want the shadow maps to render as depth 
only without lighting calculations.
That conflicts with shaders in the materials since they simply are not 
run any more when the material is overridden. I ran into the same 
problem once and added the PCF2_SHADOW_MAP mode which does not use a 
material override but individual chunk overrides, so shaders should 
still get to run. Can you give that mode a try?

> Can you point me to
> the code where the shadow casters are rendered?

e.g. PCF2ShadowMapHandler::createShadowMapsFBO() in 
Source/System/NodeCores/Groups/Effects/ShadowStage/OSGPCF2ShadowMapHandler.cpp 
and similar in the handlers for other shadow map modes.

        Cheers,
                Carsten

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to