Problems with shadow maps

Posted By: bs_twinbits

Problems with shadow maps - 12/09/04 06:58

A6 Prof. Vers 6.31.4 MapComp. 6.25
I have some ugly problems with the shadows in my level.It's build out of two floors. In the first floor I put some office furniture as an mdl model. I give the shadow flag to this model in WED. The model looks fine and the shadow on ground from the first floor is fine, but it builds a shadow through the first floor to the ground floor too. How can we solve this problem, because without the shadow flag, the office model looks not nice.
Regards
BS
twinbits

Posted By: Marco_Grubert

Re: Problems with shadow maps - 12/09/04 08:47

This is not a shadow map, it's a stencil shadow. JCL will have to give a more precise answer but I think that's just a general problem with stencil shadows in that they are not cut by geometry. One thing you can do is reduce the SHADOW_RANGE value so that shadow volumes don't extend as far. Another work-around would be to create a passable black 0-height copy of your furniture and place it manually.
Posted By: Orange Brat

Re: Problems with shadow maps - 12/09/04 08:49

EDIT: Marco beat me to it.

That's a limitation of using stencil shadows. Geometry doesn't clip the shadow, so although it will look nice and pretty on floor one, that same shadow will essentially bleed down to the ground floor. One of a handful of ways to eliminate this and still use your current setup is to turn the furniture model invisible when the player reaches a certain disntance from it.

Code:

while(1)
{
if(vec_dist(my.x,player.x) >= ????)
{
my.invisible = on;
}
else
{
my.invisible = off;
}
wait(1);
}



Alternatively, instead of using vec_dist, if the player's X falls outside a certain hardcoded area(like below the 1st floor Z), then you could turn it off that way as well.
Posted By: bs_twinbits

Re: Problems with shadow maps - 12/10/04 06:30

Thank you for your reply !
Ok, this stencil shadows looks nice at our mdl models, but we don't have them, if you doesn't use the shadow flag for your models :-). Maybe it's a work-around to use 0-high model as the shadow on the floor, but you don't have any shadow at your models itself. The result is very very ugly ! For me this problem with the stencil shadows is a great one, because now it's hard to make nice looking maps with buildings out of more then only a ground floor. To clip the models away when the player comes into the area of my models is hard to do for each office furniture in my maps.
bs
Posted By: qwerty823

Re: Problems with shadow maps - 12/10/04 07:51

One way would be to turn shadows off on your models initially. When your player transitions from one floor to another, setup a trigger to change a floor variable as to which floor the player is moving to. The models can have an action to turn their shadows on if they are on the same floor as the player. This would still take some carefull planning to make sure the player can only change floors where there are triggers.
Posted By: jcl

Re: Problems with shadow maps - 12/10/04 18:38

Yes, querty's suggestion of dynamically switching shadows on and off is the best way to avoid this problem. Have an entity action check it's z position compared to the camera, and only activate the shadow flag when the camera is higher than the entities' feet.
Posted By: uman

Re: Problems with shadow maps - 12/10/04 22:06

Yes I have the problem - we need a fix.

I have a small building with a ladder against it. The ladder casts a beautiful shadow on the wall its against. As you approach the building which cant be avoided you see two sides at once and two (one distorted) shadows, one on each side of the building. i.e. corner position : previously you see an ugly incorrect shadow first on one wall and floor below before you even get to see the ladder, (which has the correct shadow) around the corner which causes it.

In my case scenario which in many instances is a typical one I would think -suggested fixes would not work as the correct and offending shadow can be seen at the same time. Its not in a different location or on a different level, but almost attached to the correct one.

How do we turn off Stencil shadows and go back to using the old shadow system - can we do that? Lets hope so as although the stencil shadows do look great when they work properly they are extremely ugly when not.

Great shadows in parts of a game are no recommendation for supporting a system which causes such problems in others.

Work arounds as suggested are not practical in levels with hundreds of entities for various reasons - extra work is not needed and fixing faults are an attempt at a cure - when prevention is whats needed. The problem needs fixing so that stencil shadows work correctly or take them out of the engine altogether.
Posted By: jcl

Re: Problems with shadow maps - 12/11/04 02:00

As you've noticed yourself, every shadow method has its advantages and disadvantages. As a game designer it's up to you to choose the right combination of static, stencil, or z buffer shadows for your game, so that every part looks right. Gamestudio can offer some tools, like different shadow methods, but can not "fix" your game.
Posted By: Orange Brat

Re: Problems with shadow maps - 12/11/04 05:05

Quote:

Yes I have the problem - we need a fix.




It's not a bug, it's the way stencils work and the workarounds provided(my way or qwerty's way) work perfectly. Dynamic lights are exactly the same..they aren't clipped by geometry(and the same workarounds work for them, too). Assuming there is no way to make them them clip, then this sounds like a DirectX quirk and not a Conitec one. You'll need to contact Microsoft.

I've played plenty of AAA caliber games with non-clipping dynamic lights and stencils(Half-Life 2 comes to mind). It's up to you, the level designer, to insure that the clipping is not seen. Even the big boys slip up with this sometimes.
Posted By: Matt_Aufderheide

Re: Problems with shadow maps - 12/11/04 05:21

Frankly if your maps are built correctly.. any floor above the one the camera is in ought be culled by the visibility system, so the models on that floor ought to be culled too. Then of course this problem wont happen.. if however it does.. simply turn off shadows if camera.z<model.z
© 2024 lite-C Forums