Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Stencil shadows problem

Author
Message
DJ Chena
16
Years of Service
User Offline
Joined: 13th Jan 2009
Location:
Posted: 23rd Feb 2009 19:56
Hi again, I'm have a problem whit stencil shadows, see screenshot attached, the shadows not make fine whit terrain elevations, seems inverted shadow.

Another question, i use per pixel lighting, and when I apply to textures whit transparency, like grass, trees... result is transparent object. Can be use transparent texturex whit a shader?

www.ruidoatomico.com

Attachments

Login to view attachments
gbark
19
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 24th Feb 2009 03:22 Edited at: 24th Feb 2009 03:29
What looks like is happening (anybody with more knowledgeable experience, correct me if I'm wrong) is that your shadow isn't "stopping" after being cast on the ground. Basically, the object is casting a shadow on the high part of the ground, then it keeps going, through your hill, casting a second shadow on the low part of the terrain.

Unfortunately there's no simple solution for this. I think this thread has the same problem you're having -- "light" not stopping when it hits the terrain -- but with different a different execution than what you're doing. Honestly there doesn't seem to be a simple fix for this as far as I know, pretty much every time this comes up it seems people are forced to just find workarounds.

You could try increasing the angle of the shadow casting (casting shadows from a more high-noon type angle rather than an early morning type angle), or look into shadow mapping your terrain as well, but honestly I don't know if that would solve your problem at all.

(Though if you think about, in reality, what you're describing is almost the correct result of what would really happen -- You only notice an oddity because your terrain is not casting shadows on itself, when in real life, it would.)



As per your second question, DBPro's default stencil shadow commands DO take transparency into account. If you have a static plain with a transparent grass texture, then any shadows casted on it should only cast the visible parts of the texture onto the ground. This will probably eat FPS though, so you should occasionally check each of these objects and only cast shadows on the ones that are close to the camera. As for whether or not external stencil shadow shaders work in this same way, I honestly don't know, but I imagine you could get them to work similarly.

Login to post a reply

Server time is: 2025-06-19 06:20:09
Your offset time is: 2025-06-19 06:20:09