HI,

I am using the the shaders from osgShadow, in case just "fragmentShaderSource_withBaseTexture"...

"uniform sampler2D baseTexture; \n"
   "uniform sampler2DShadow shadowTexture; \n"
   "uniform vec2 ambientBias; \n"
   "\n"
   "void main(void) \n"
   "{ \n"
" vec4 color = gl_Color * texture2D( baseTexture, gl_TexCoord[0].xy ); \n" " gl_FragColor = color * (ambientBias.x + shadow2DProj( shadowTexture, gl_TexCoord[1] ) * ambientBias.y); \n"
   "}\n"

because I set the textureUnit to only 1. The corresponding code to set up the fragment program is...

osg::Program* program = new osg::Program;
   _stateset->setAttribute(program);

osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_withBaseTexture);
program->addShader(fragment_shader);

osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
_stateset->addUniform(baseTextureSampler);

osg::Uniform* shadowTextureSampler = new osg::Uniform("shadowTexture",1);
_stateset->addUniform(shadowTextureSampler);
osg::Uniform* ambientBias = new osg::Uniform("ambientBias",osg::Vec2(0.3f,1.2f));
   _stateset->addUniform(ambientBias);

Is this a mistake?
I only get this Problem when trying to use the shadows with osg 1.2. In osg 1.9.5 I get no artifact like this.

Thanks for your help,
Marcus

Robert Osfield schrieb:
Hi Marcus,

How are your setting up your shadow mapping?  I'd suspect something
might be up the shader, but really have too little info to go to give
a good answer.

Robert.

On 6/5/07, Marcus Fritzen <[EMAIL PROTECTED]> wrote:
Hello,

perhaps someone can help me with a problem I have. Attached is the image
I get when using shadow mapping. At present I don't know where the
artifacts on the ground and the cube came from. I use following settings
for the textures:

setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE );
setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE );
setShadowTextureMode( osg::Texture2D::LUMINANCE );
setInternalFormat( GL_DEPTH_COMPONENT );

Greets,
Marcus

--
----------------------------------------------------------------
Marcus Fritzen                  E-mail: [EMAIL PROTECTED]
University Koblenz
Triererstr. 105, 56072 Koblenz,
HIWI FB4 Herr Jackel
----------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


--
----------------------------------------------------------------
Marcus Fritzen                  E-mail: [EMAIL PROTECTED]
University Koblenz              Mobil:  +491786867360
Triererstr. 105, 56072 Koblenz, 
HIWI FB4 Herr Jackel
----------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to