Hi Jefferson,
When using a shader that expects a texture, you must supply a texture
or the result is undefined.  I think with most graphics cards the
texture read just results in black.  So if you want to have models
that don't have a specific texture you should:
a) use another shader that doesn't do a texture read, or
b) set a simple default texture (for example, a 1x1 white texture) on
the root node of your scene.

- Terry

> Message: 4
> Date: Fri, 31 Oct 2008 23:30:23 -0300
> From: "Jefferson Pinheiro" <[EMAIL PROTECTED]>
> Subject: [osg-users] Untextured materials = pure black
> To: [email protected]
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Every material that has no texture associated becomes completely black when
> I do one of the following:
>
> - change the shadow technique from ShadowMap to SoftShadowMap
> - add any of the GLSL bloom shader I found on the net (
> http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=27976&postdays=0&postorder=asc&start=0or
> http://www.gamedev.net/community/forums/topic.asp?topic_id=395186)
>
> Any idea why this is happening?
>
> Details:
>
> I have a single light, declared thusly:
>
>    osg::Vec3 lightPosition(40000,40000,80000); // my prog's scale is big
>    osg::LightSource* ls = new osg::LightSource;
>    ls->getLight()->setPosition(osg::Vec4(lightPosition,1));
>    ls->getLight()->setAmbient(osg::Vec4(0.5,0.5,0.5,1.0));
>    ls->getLight()->setDiffuse(osg::Vec4(0.9,0.9,0.9,1.0));
>    shadowedScene->addChild(ls);
>
> I'm posting direct links to the shaders, case you're lazy to open those ones
> :)
>
> http://magiadosdoces.com/temp/PP_GL_Bloom1.fx
> http://magiadosdoces.com/temp/PP_GL_Bloom2.fx
> http://magiadosdoces.com/temp/PP_GL_Bloom3.fx
> http://magiadosdoces.com/temp/PP_GL_Bloom4.fx
> http://magiadosdoces.com/temp/shader.frag
>
> And this is how I'm loading the shaders:
>    osg::ref_ptr<osg::StateSet> stateSet(root->getOrCreateStateSet());
>    osg::Program* program = new osg::Program;
>    osg::Shader* frag = new osg::Shader( osg::Shader::FRAGMENT );
>    frag->loadShaderSourceFromFile("Shaders/shader.frag");
>    program->addShader(frag);
>    stateSet.get()->setAttributeAndModes(program, osg::StateAttribute::ON);
>
> I'm using OSG 2.6, Windows Vista 64, Geforce 8800M GTS.
>
> Oh and by the way, the bloom shader effect doesn't works even on the
> textured surfaces. They simply remain the same. Image:
> http://magiadosdoces.com/temp/car.jpg
>
> Thanks,
> Jefferson
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20081031/e7d8b42c/attachment-0001.htm>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to