This project is read-only.

Shadows and MaterialShader?

Aug 2, 2009 at 4:32 PM

Hi StatusUnknown,

I'm now working on applying to my scene meshes Diffuse, Norma maps and Shadows (including self shadowing).

It seems in your Tutorial 25 that you replace the scene meshes' shaders by a ShadowMapping shader (if I understand it right). Is that the way it should be implemented? I cannot use the MaterialShader AND shadows? Do I have to create my shader so that it supports diffuse, normal maps and shadowmapping in one unique shader?

Thanks,

Philippe

Aug 3, 2009 at 1:36 PM

Actually, tut 25 does use MaterialShader for the ambient light and the backlighting. It's just the effect is accumulated over several passes. So while they are separate shaders, their output is added together (so it's ambient/backlight + main light with shadow).

It would be better to keep everything in one single shader, but only if it doesn't blow out and become overly complex. If your lighting never changes (for example, if it's always one directional light + ambient, then that'd be a good case for a single shader)

Aug 3, 2009 at 9:11 PM

Therefore, what you recommend is that if we have multiple lights that could change over time, we should use MaterialShader and an additional shader for shadows for instance?