Jump to content

  • Log In with Google      Sign In   
  • Create Account


Turning the ground white from snow


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 codeman_nz   Members   -  Reputation: 229

Like
0Likes
Like

Posted 12 February 2013 - 09:18 PM

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?



Sponsor:

#2 ProvenDantheman   Members   -  Reputation: 111

Like
0Likes
Like

Posted 12 February 2013 - 09:23 PM

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.



#3 CC Ricers   Members   -  Reputation: 623

Like
3Likes
Like

Posted 13 February 2013 - 01:21 AM

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.


My development blog: Electronic Meteor

#4 bwhiting   Members   -  Reputation: 680

Like
0Likes
Like

Posted 13 February 2013 - 03:38 AM

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



#5 samoth   Crossbones+   -  Reputation: 4629

Like
0Likes
Like

Posted 13 February 2013 - 05:58 AM

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).

#6 LouisCastricato   Members   -  Reputation: 121

Like
0Likes
Like

Posted 13 February 2013 - 12:54 PM

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


Edited by LouisCastricato, 13 February 2013 - 12:54 PM.


#7 codeman_nz   Members   -  Reputation: 229

Like
0Likes
Like

Posted 13 February 2013 - 01:21 PM

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



#8 CC Ricers   Members   -  Reputation: 623

Like
0Likes
Like

Posted 13 February 2013 - 02:13 PM

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.


My development blog: Electronic Meteor




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS