Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: ErV on October 17, 2006, 10:38:23 PM

Title: Problems with flat shadows.
Post by: ErV on October 17, 2006, 10:38:23 PM
Hello.
I've noticed that in certain situations flat shadows causes graphical artifacts.The model rendered to the texture simply doesn't fit in some cases. Because texture uses D3DTADDRESS_CLAMP, edges of texture, filled with non-transparent color, stretch to inifnity and make shadow look unrealistic. How can this be avoided?
Title: Re: Problems with flat shadows.
Post by: Mnemonic on October 19, 2006, 05:23:58 PM
Well, it could be avoided 1) by using stencil shadows 2) by limiting the light position to certain ranges to avoid too long shadows.
Title: Re: Problems with flat shadows.
Post by: ErV on October 19, 2006, 09:29:40 PM
Well, it could be avoided 1) by using stencil shadows 2) by limiting the light position to certain ranges to avoid too long shadows.
Well... problem isn't with long ranges, but with the certain angles/points of view. When the camera direction gets close to 45 degrees, sometimes part of model gets clipped by frustrum and stretches to infinity. Another problem is that flat shadows disappear when applied to a VERY large model. (Models gets clipped by ZFar, I suppose).

Right now I'm using stencil shadows, but they're 2times slowdown...

P.S. Why don't you use D3DPRESENTINTERVAL_IMMEDIATE? It would be a big speedup for a game. (what about 200 fps on Riva TNT?)
Title: Re: Problems with flat shadows.
Post by: Mnemonic on October 20, 2006, 08:33:56 AM
P.S. Why don't you use D3DPRESENTINTERVAL_IMMEDIATE? It would be a big speedup for a game. (what about 200 fps on Riva TNT?)
IMO that's not something a game should force the player into. At least it should be user-selectable.
Title: Re: Problems with flat shadows.
Post by: ErV on October 20, 2006, 11:24:36 AM
P.S. Why don't you use D3DPRESENTINTERVAL_IMMEDIATE? It would be a big speedup for a game. (what about 200 fps on Riva TNT?)
IMO that's not something a game should force the player into. At least it should be user-selectable.
That's your choice.

But what can I do with disappearing shadows?
Title: Re: Problems with flat shadows.
Post by: Mnemonic on October 20, 2006, 02:42:59 PM
Ok, try this: http://dead-code.org/download/wme_latest.zip

I removed the infinite clamping, increased the far clipping for shadow projection and fixed the disabled light loading from 3ds.
Title: Re: Problems with flat shadows.
Post by: ErV on October 20, 2006, 08:01:39 PM
Ok, try this: http://dead-code.org/download/wme_latest.zip

I removed the infinite clamping, increased the far clipping for shadow projection and fixed the disabled light loading from 3ds.
You mean - zFar/zNear for shadow renderer is static? And, maybe FOV, too? Wouldn't be better to change zFar, zNear and FOV for rendering shadows dynamically, based on character bounding box/distance from light? (Calculations are quite easy) It would solve model clipping problem. What do you think?