Hello Carsten, sorry already coming back to this :)
On 17.09.2012 11:51, "Christoph Fünfzig" wrote: > Hello Carsten, > > On 14.09.2012 16:41, Carsten Neumann wrote: >> 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? >> > In that mode, I get a fully black window. Sorry! >>> 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. > > I will look into the code of PCF2ShadowMapHandler today. > So if you already have an idea what might go wrong .. What does not work for me with PCF2ShadowMapHandler is svp->setAutoSearchForLights (true); Listing them explicitly does // add light sources explicitly for (unsigned i=0; i<lights.size(); ++i) { svp->editMFLightNodes()->push_back(lights[i]); } The test program "testShadowST.cpp" also lists the light sources explicitly! Is there a reason for this special behavior? Perhaps "setAutoSearchForLights" should be deprecated? How about making the handling of material chunks over all shadow modes the same? Thanks again, Christoph ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users