[Ogre19+ANGLE GLES2] Stencil modulative shadow not working?

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
shikui
Gnoblar
Posts: 6
Joined: Sat May 24, 2014 9:59 am

[Ogre19+ANGLE GLES2] Stencil modulative shadow not working?

Post by shikui »

I don't know if it is appropriate that I post here but I seem to have a problem.
I have set up a simple scene to test shadows using GL / D3D9 / ANGLE-GLES2 renderers on windows, respectively.
The scene is identical except for the shadow technique and renderer in use. Stencil modulative shadow don't work if ANGLE GLES2 renderer used. As following table shows.

Code: Select all

                              GL                D3D9                     ANGLE-GLES2
STENCIL MODULATIVE SHADOW    works              works                    not work
TEXTURE MODULATIVE SHADOW    works              works                      works
I have debugged a little. Stencil buffer is supported on my ANGLE-GLES2 setup. Runtime control flow in OgreSceneManager seems normal to me. Debug shadows flag is on and renderShadowVolumeObjects are called, but neither shadow nor shadow volume is rendered. The Ogre version is v1-9. Any clue please?

Thanks!

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine
x 41

Re: [Ogre19+ANGLE GLES2] Stencil modulative shadow not worki

Post by Eugene »

May be because GLES2 does not support FFP, and mShadowModulativePass does not have shaders?
I have this problem on D3D11, so I`ll fix it and there would be place to insert shaders for GLES2 too.

shikui
Gnoblar
Posts: 6
Joined: Sat May 24, 2014 9:59 am

Re: [Ogre19+ANGLE GLES2] Stencil modulative shadow not worki

Post by shikui »

Eugene wrote:May be because GLES2 does not support FFP, and mShadowModulativePass does not have shaders?
I have this problem on D3D11, so I`ll fix it and there would be place to insert shaders for GLES2 too.
Well it does seem to me that both mShadowDebugPass and mShadowModulativePass are FFP only, while mShadowStencilPass supports shaders for specific renderer. It answered my question. Thanks for your reply.

User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Odessa, Ukraine
x 41

Re: [Ogre19+ANGLE GLES2] Stencil modulative shadow not worki

Post by Eugene »

shikui wrote:Well it does seem to me that both mShadowDebugPass and mShadowModulativePass are FFP only, while mShadowStencilPass supports shaders for specific renderer. It answered my question. Thanks for your reply.
I fixed this problem for D3D11 - wrote simplest shaders that do what needs to be done. Similar shaders should be written for GLES2 too. Can you take a look at https://bitbucket.org/eugene_gff/ogre-p ... 0006fb3398 and add corresponded shaders?

shikui
Gnoblar
Posts: 6
Joined: Sat May 24, 2014 9:59 am

Re: [Ogre19+ANGLE GLES2] Stencil modulative shadow not worki

Post by shikui »

Eugene wrote:I fixed this problem for D3D11 - wrote simplest shaders that do what needs to be done. Similar shaders should be written for GLES2 too. Can you take a look at https://bitbucket.org/eugene_gff/ogre-p ... 0006fb3398 and add corresponded shaders?
Well I don't know yet.The following simple shaders should do.

Code: Select all

const String gShadowModulativePassVs_glsles =
		"#version 100\n"
		"precision highp float;\n"
		"precision highp int;\n"
		"precision lowp sampler2D;\n"
		"precision lowp samplerCube;\n\n"
		"attribute vec4 position;\n\n"
		"void main()\n"
		"{\n"
		"    gl_Position = vec4( position.x,position.y,position.z,position.w);\n"
		"}\n";

	const String gShadowModulativePassPs_glsles =
		"#version 100\n"
		"precision highp float;\n"
		"precision highp int;\n"
		"precision lowp sampler2D;\n"
		"precision lowp samplerCube;\n\n"
		"void main()\n"
		"{\n"
		"    gl_FragColor = vec4(0.0, 0.7, 0.7, 1.0);\n"
		"}\n";
But I found that AutoParams doesn't seem to work wth GLES2. So shadow caster program may not work as expected.

And scene blending should be SBT_MODULATE.

Code: Select all

mShadowModulativePass->setSceneBlending(SBT_MODULATE); 
Am I wrong? :D

Post Reply