Hi Bradley,

I have not tested StandardShadowMap with Catalyst 10.7. 10.5 & 10.6 did not work for me so I have been staying at 10.4. With 10.4 the only issue I had was TexMat not initialized to identity and mainVertexShader in Standard Shadow Map was producing 0,0 base texture coords for all frgments.

I guess you have a bit different situation, though. You write that your scene already contains programs with shaders. When NULL program is applied with override, it means that your shaders are blocked and fixed pipeline draws the shadow map. So you may have the problems if your shaders compute alpha with some non standard (non repeatable in fixed pipeline) way or discard fragments.

I must admit that for above case setting NULL program might be seen as a bug. However, it was done in purpose to make shadow map rendering faster because color does not need to be computed and thus there is no need to use existing usually more complex shaders. But if they discard fragments or compute depth it may be not such good idea after all... We may try to come up with a new method to let user select if he/she wants to set this NULL program or not.

Out of curiosity does the same problem appear in osgshadow example ? The example works on 10.4 (with minor TexMat modification).

Try: osgshadow -4 --lispsm  or  osgshadow -4 --stsm

Cheers,
Wojtek
--------------------------------------------------
From: "Bradley Baker Searles" <[email protected]>
Sent: Wednesday, July 28, 2010 12:48 AM
To: <[email protected]>
Subject: [osg-users] StandardShadowMap on ATI

Hi,

I have been working for a while on compatibility issues with nVidia and ATI in our OpenSceneGraph application. Aside from a fair number of GLSL shader source issues, one of the last remaining problems was that textured objects were not casting shadows (please see first attached screenshot).

After a little detective work, it seems that the empty osg Program attached to the StateSet belonging to the _camera in StandardShadowMap::ViewData::init() is causing the problem:



        // optimization attributes
        osg::Program* program = new osg::Program;
stateset->setAttribute( program, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON );
        stateset->setMode
( GL_LIGHTING, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );
        stateset->setMode
( GL_BLEND, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF );

#if 0 // fixed pipeline seems faster (at least on my 7800)
        program->addShader( new osg::Shader( osg::Shader::FRAGMENT,
"uniform sampler2D texture; \n" "void main(void) \n"

"{                                                                \n"
" gl_FragColor = texture2D( texture, gl_TexCoord[0].xy ); \n" "} \n"
        ) ); // program->addShader Fragment

        program->addShader( new osg::Shader( osg::Shader::VERTEX,
"void main(void) \n"

"{                                                                \n"
" gl_Position = ftransform(); \n" " gl_TexCoord[0] = gl_MultiTexCoord0; \n" "} \n"
        ) ); // program->addShader Vertex
#endif



The setting of the fragment and vertex shaders to the stateset are #if 0'd out, but the osg Program setting is not.

Anyway, if I skip adding the empty program, things seem fine. Oddly, if I keep the empty program and skip the AlphaFunc above it that allows texture alpha to affect the depth buffer render, it casts shadows properly (well, without the alpha penetration of course).

 Everything works fine with nVidia drivers, even with the empty program.

My scene has a mixture of shader programs depending on how the objects are setup, but they all include the shadow shader source (except the flat shaded objects like the force arrows shown below).

So it seems to be an easy fix, but I was curious if anyone else had run into this problem? I did many searches on the forum and came up empty.

And if anyone has deeper illumination into how the empty program could affect the statesets (seems like a bug to me since nVidia works fine), or if there is a more appropriate fix I'm not thinking of, I'd appreciate the feedback.

Thanks-
Baker Searles


Hardware Versions:
nVidia GTS 250
ATI Radeon HD4670

Software Versions:
OSG @ 2.8.3
ATI Display Drivers @ 10.7
nVidia Display Drivers @ 258.96

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30329#30329




Attachments:
http://forum.openscenegraph.org//files/ati_emptyglslprogram_noalphafunc_163.jpg
http://forum.openscenegraph.org//files/ati_noemptyglslprogram_192.jpg
http://forum.openscenegraph.org//files/ati_emptyglslprogram_debughud_103.jpg
http://forum.openscenegraph.org//files/ati_emptyglslprogram_167.jpg


_______________________________________________
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