Cheap Dynamic Cloud Shadows

Hi everyone!
Such a long time I don’t post in here!
Great to be back! :slight_smile:

I currently have a world that contains a skybox with animated cloud layers and a flat floor. I placed a scrolling plane with a shadow texture (blending) just on top of the floor, that simulates moving clouds shadows (only used blending in this case instead of multitexturing)

I now want to change the plane to a 3d terrain. However I don’t to spend neither coding time nor CPU time on the shadows, as the program already contains some heavy things running on.

Could you anyone tell me if the following solution is possible/efficient for achiving the previous effect with a 3d non-flat terrain?:
1)-Render the terrain with a static shadow-map pre-rendered texture (containing only the shadows produced by the terrain itself and the static sun).
2)-Then, do a multitexturing pass with a clouds’shadow texture on the whole 3d terrain surface. Scroll only this texture simulating moving clouds. (Is it possible to apply a texture transformation to just one of the multitextures applied to an object?)

Also, what do you consider as the best Texture Environment Mode for this case?

The only drawback is that while the terrain gets shadowed by the dinamic clouds, the skybox’s mountain’s dont. That makes it look fake. Any suggestions?

Thanks so much in advance,
Cheers! :smiley:
Rod

Yea, that would work if you use the correct shader to blend the two shadow maps.

About the skybox, you need to somehow get the fine grain data with either depth or texture cordinates into the skybox with a second texturemap.

Alternatively you could use a rough geometric mesh to project the shadows on, but then you will loose the fine grain data.

Originally posted by Rodrix:
Could you anyone tell me if the following solution is possible/efficient for achiving the previous effect with a 3d non-flat terrain?:
1)-Render the terrain with a static shadow-map pre-rendered texture (containing only the shadows produced by the terrain itself and the static sun).

Not sure about that, depending on your target this may be overkill. Large shadowmaps does also have a few problems so maybe you’ll need some extra machinery.
If it is to be static, it could be better to pre-bake it to a lightmap (baked at runtime) so it’s possible to get more uniform sampling rates. Unless you have very fine details, some local occlusion methods may be fine for generating that. If the terrain is too large however, this method also requires some management.

Originally posted by Rodrix:
2)-Then, do a multitexturing pass with a clouds’shadow texture on the whole 3d terrain surface. Scroll only this texture simulating moving clouds.
This is very convincing. Go for it. If you can use a gaussian blur kernel it looks even better because of better transitions but most users won’t notice. Adding Noise to the borders also produces interesting effects but this is more subject to personal feeling (not to mention you must have Noise to get).

Originally posted by Rodrix:
Is it possible to apply a texture transformation to just one of the multitextures applied to an object?
Definetly yes!
When you call ActiveTextre, you’re not just selecting TEXTUREn as the active texture image unit but also the related state. As such, you can just “translate” the TEXTURE matrix stack, which is private to each unit.

Originally posted by Rodrix:
Also, what do you consider as the best Texture Environment Mode for this case?
BLEND?

Originally posted by Rodrix:
The only drawback is that while the terrain gets shadowed by the dinamic clouds, the skybox’s mountain’s dont. That makes it look fake. Any suggestions?
Don’t stretch it too much. It doesn’t necessarly have to look unrealisic (this sometimes happens in the real world).
Anyway, if you want your skybox to be shadowed… don’t use a skybox!

Thanks guys! :slight_smile:
I will give it a try and then post results! :wink: