Turning the ground white from snow

Started by
5 comments, last by CC Ricers 11 years, 2 months ago

Hi everyone,

In my game I want to turn the ground white from snow. So it starts off as a normal grass texture then it starts snowing and the ground turns white. Then the snow stops falling and the ground goes back to the rnomal grass texture again.

Any ideas?

Advertisement

Hold the RAW pixel data of the texture in two arrays. Use array two, to display the texture. Array one will be const, that way you can't change it.

Now, when you initialize, load the texture into array one and two.

When it starts to snow, add values to random pixels over time in array two so it will slowly start turning white.

When it is done snowing, revert the pixels back over time to the original texture using data from array one.

I would use some kind of noise to filter and lerp between the snow and the grass. The flexibility comes with being able to switch between noise functions for adding and removing snow. That way you can have a snow melting effect that is more convincing, and not just look like snow buildup in reverse.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

Using a noise map as a lerp value would be my choice here too!

Noise function, or texture. Add to that a coverage map, which is more or less something like a very low resolution shadow map from above.


That way, you don't have snow under structures (say, a roof, tent, park bench) where people wouldn't expect to see snow, and you can even have footsteps or wheel tracks if you invest only a little more work.


If you're really serious about doing hardcore snow, you can not only change the color, but also extrude vertices upwards. This was described in Shader X4 some years ago, and looks quite cool even without modern bric-a-brac like tesselation (though that would probably add even more realism).

If you want this to look really amazing, layer a texture over the ground as snow begins to fall.

This texture can be dynamically generated, or prebaked. (Just depends on what quality and performance you want)

As the snow begins to fall, I strongly feel that a glow effect might make it look pretty amazing.

I like the idea of the noise function, but I think it might be better if the snow overlay is generated based off the terrain that it falls on, ie: it clusters on the sides of hills, spreads out on hill tops, etc, etc

Thanks everyone. So what is a noise function and how do I implement it?

If you want this to look really amazing, layer a texture over the ground as snow begins to fall.

This texture can be dynamically generated, or prebaked. (Just depends on what quality and performance you want)

As the snow begins to fall, I strongly feel that a glow effect might make it look pretty amazing.

I like the idea of the noise function, but I think it might be better if the snow overlay is generated based off the terrain that it falls on, ie: it clusters on the sides of hills, spreads out on hill tops, etc, etc

That's a good addition as well. Mtnphil has written an article about how he does snow cover on the terrain.

Because snow usually does not stay on steep cliffs and sides, the snow texture is only applied in surfaces where the normals predominantly point upwards. It also gives a quick explanation on noise functions and textures created with one to apply the snow cover.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

This topic is closed to new replies.

Advertisement