Depth shadow mapping and PSSM with custom shader

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Depth shadow mapping and PSSM with custom shader

Post by kubatp »

Hi,
I was googling and trying to find a running example of Depth Shadow mapping and PSSM with custom receiver shader and custom caster shader. For simplicity, lets call the receiver mesh terrain and caster mesh unit.

I found examples of terrain and unit which are without custom shaders, but not applied to custom shaders (even the simple ones, which simply do the same as fixed pipeline).

Does anyone have a link or code where this is used?
Thank you very much in advance.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Depth shadow mapping and PSSM with custom shader

Post by dark_sylinc »

The sample ShadowsV2 under Samples/ApiUsage/Lights/ShadowsV2 in the 2.0 branch shows how to do exactly this, and the code should work in 1.x as well (Materials + Shaders in 1.x and 2.0 remained the same. Compositor part only applies to 2.0)
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Depth shadow mapping and PSSM with custom shader

Post by kubatp »

I was able to create functional custom shader, which shows lit and cast shadows on the plane.

My last problem is self shadowing and my knowledge about shadows is limited, so I have few questions:
I just want to clarify what I mean by self shadowing - it means that the mesh can cast shadow on itself, like you can see here
  1. Is it possible in general to have self shadows for integrated texture based shadows? The screenshot was taken from the ogre samples, but when stencil shadows were turned on. When I switched to texture shadows, there was no example of successful self-shadowing...?
  2. How exactly is shadow texture unit created? In my case I can see the colour channel only full or empty (the colour channel is either 0 or 1, but never anything between).
  3. Is there a way how I can change the shadow texture creation?
  4. Is there a working sample where texture based shadows have self shadows?
Thank you for your help guys
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Depth shadow mapping and PSSM with custom shader

Post by kubatp »

And one more question:
where can be the problem when my meshes have lit but the shadow texture is always pure red? Can I have something incorrectly setup?
Post Reply