I’ve trying to use shadow2DProj in GLSL for getting shadow, but seems It works incorrect. In my case It always return 0, however If I use (texture2D(samp0, co.xy).x > co.z) instead of shadow2DProj(samp0, co).x, then I see more or less correct result.
What could it be?
I not see errors in the console. I use uniform sampler2DShadow and sampler2D in case of shadow2DProj and texture2D respectively.
In Panda I create my shadow buffer as follows:
props = FrameBufferProperties()
props.setRgbColor(0)
props.setAlphaBits(0)
props.setDepthBits(1)
LBuffer = scene.show_base.graphicsEngine.makeOutput(
scene.show_base.pipe, "offscreen buffer", -2,
props, winprops,
GraphicsPipe.BFRefuseWindow,
scene.show_base.win.getGsg(), scene.show_base.win)
Ldepthmap = Texture()
Ldepthmap.setFormat( Texture.FDepthComponent )
LBuffer.addRenderTexture(Ldepthmap, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
May be I created incorrect buffer or texture? Or my video card not support sampler2DShadow?
About videocard I am not sure, but seems that this code works in Blender, at least shader code was exported from it an seems that worked, so I think that I missed something in creating and passing shadow buffer.