Terrain with shadows?

Posted By: Kamiomi

Terrain with shadows? - 06/26/06 08:08

(I could have sworn I posted this question, but I can't find it, so I'll ask it again)

I'm using a terrain in my level, and well... I've seen some screenshots here and there, of entities casting shadows on HMP terrains, but nothing casts a shadow on my terrain. It would be nice.

Is that something that is easily done (like I made a mistake somewhere), or does it use a texture projection shader or something?



Posted By: ShoreVietam

Re: Terrain with shadows? - 06/26/06 09:47

To have flat shadows of models on terrain just switch their shadow flag on.

Level geometry and levelmaps won't cast shadows.

When you're using shaders to render the terrain they may overwrite your models shadows.
Thus you could write a own shader function to render models shadows.

To have level geometry and level map shadows you'd have to write your own shader or modify the one from the wiki.
Just multiply the result matrix with the .a (alpha) matrix and deactivate alphablendenable and alphatestenable so that the alpha channel is not used for alpha blending but for multiplying the result texture matrix with 0...1 which looks like that:

(The ratrace function to pre-render this shadowmpar tooks 3~5 minutes, thus they really are static.)





Posted By: Kamiomi

Re: Terrain with shadows? - 06/26/06 10:30

I'm just using MDL entities, on a HMP terrain - I just made sure all their shadow flags were on in their actions (trees, and a character), and still, none of them are casting shadows on the terrain...

That really makes me wonder what's going on. I'm not too worried about it because the terrain has a varied texture, and "Serious Grass" to cover it, but still, the shadows would really look nice.


Posted By: frazzle

Re: Terrain with shadows? - 06/26/06 10:44

Before you can have some shadows, you need to turn the sun
on in your map properties like this:



Posted By: Kamiomi

Re: Terrain with shadows? - 06/26/06 11:17

That didn't work.

(I'm kind of glad though, I don't want to set my sun elevation so high, because my camera doesn't look up that far, and I made the most awesome lens flare - so I don't want to miss it)

I hope this isn't an indication of some kind of serious problem in my level - if I don't end up getting shadows to work, I can live with it, but I don't want major errors later on.


Posted By: vlau

Re: Terrain with shadows? - 06/26/06 19:46

1. add a level block, scale it as large as your terrain(hmp),
texture it of course.

2. place the level block under your terrain(hmp) as close as possible
3. check the shadow flag of your model
4. compile then run

You should see the shadow cast on your terrain(hmp)
Posted By: Kamiomi

Re: Terrain with shadows? - 06/26/06 20:59

thanks vlau, that worked (strange though, I have other blocks in the level that are around the size of the terrain, although they aren't that close underneath it).


© 2024 lite-C Forums