Author Topic: Question on shadows  (Read 5063 times)

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Question on shadows
« on: June 15, 2008, 08:17:40 pm »
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
« Last Edit: June 15, 2008, 08:19:25 pm by JavaMan »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Question on shadows
« Reply #1 on: June 15, 2008, 09:27:19 pm »
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.

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Question on shadows
« Reply #2 on: June 16, 2008, 05:10:35 pm »
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
« Last Edit: June 16, 2008, 07:32:03 pm by JavaMan »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Question on shadows
« Reply #3 on: June 16, 2008, 08:03:52 pm »
You just place a light source at the same location where the projector is.

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Question on shadows
« Reply #4 on: June 16, 2008, 08:33:00 pm »
Oh, ok. Thanks. I was doing that. I didn't know what it was called. I'll play around with it.

Jman

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Question on shadows
« Reply #5 on: June 17, 2008, 07:58:51 am »
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.

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Question on shadows
« Reply #6 on: June 17, 2008, 10:25:20 pm »
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