Question on shadows

Started by JavaMan, June 15, 2008, 08:17:40 PM

Previous topic - Next topic

JavaMan

Hi everyone,

I have been learning how to use shadow mapping in jpct, and I am using the ShadowHelper class to do it. I tried out setting my objects as both casters and receivers so that it would look like things in the real world. Unfortunately, the shadows are very poor quality. Here is a screen shot.


Are you not supposed to set an object as a caster and a receiver? I have the projector moving around in a circle in the world, and the animation of the shadows is smooth, but the shadows are poor.

When I set an object as a receiver or just a caster, the shadows appear smooth.

Thanks
Jman

EgonOlsen

Defining an object as both, caster and receiver isn't without problems...as you can see. The problems arise from accuracy problems in the depth comparision and they vary from chipset to chipset in intensity and look. You may try to play around with ShadowHelper.setCulling() and Config.glShadowZBias. However, there is no guarantee that you'll find a setting that fits. I prefer to combine normal vertex lighting and shadow mapping so that it looks like as if the object does self shadowing.

JavaMan

#2
Thanks for the response.

Could you show me how to do vertex lighting? I suppose its different than just ambient lighting? I looked around in the api, but I can't find what it is.

Thanks

Jman

EgonOlsen

You just place a light source at the same location where the projector is.

JavaMan

Oh, ok. Thanks. I was doing that. I didn't know what it was called. I'll play around with it.

Jman

EgonOlsen

BTW: The ShadowHelper has a little bug in this version. If you encounter disappearing objects when applying the shadows, please let me know. I may have to release a fix then.

JavaMan

Ok, I think I was using 1.15 with my shadow testing; I'll mess it with 1.16. Thanks for the heads up.

Jman