Jump to content
  • Advertisement
Sign in to follow this  
ChenA

How to calculate the cloud color?

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i use the perlin noise create the cloud texture. And i calculate the sky color use the method of the paper "A Practical Analytic Model for Daylight". I should blend the sky and the cloud use the formula below: final = cloud_alpha * cloud_clour + (1-cloud_alpha) * sky_colour; but i don't know how to calculate the cloud_clour. I use the 1.0 as the cloud_clour,then get the result below,it looks ugly. Who can give me some suggestion or link or article? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Unless I'm mistaken about what you want, try this: use a solid color (or some other texture) in the pixel shader for the color output, , and then use your perlin texture only for the alpha output. this way you get a nice smooth look, instead of the ugly grey outlines.

Share this post


Link to post
Share on other sites
Clouds are the color of the light shining on them. Your problem seems to be something else. My guess is that you are using the cloud_alpha value as both a blend parameter and the alpha channel.

Share this post


Link to post
Share on other sites
Matt Aufderheide:
the cloud color should match with the sky color,a solid color(or some other texture) maybe can't work well.
JohnBolton:
yeah,you are right,i know the perlin texture should only be used for the alpha channel.I don't know how to shader the cloud.I use (1.0f,1.0f,1.0f) as the cloud color now.
cwhite:
Thanks for your link.

Share this post


Link to post
Share on other sites
Quote:
Original post by ChenA
final = cloud_alpha * cloud_clour + (1-cloud_alpha) * sky_colour;


This formula looks correct. If you use 1.0 as cloud color and since cloud alpha is between 0 and 1, the resulting final color MUST be larger than the sky color. From your screenshot, however, it looks like the cloud boundaries darken the sky. Therefore, there must be a bug in the implementation. Can you post some code?

Lutz

Share this post


Link to post
Share on other sites
Quote:
Original post by Lutz
Quote:
Original post by ChenA
final = cloud_alpha * cloud_clour + (1-cloud_alpha) * sky_colour;


This formula looks correct. If you use 1.0 as cloud color and since cloud alpha is between 0 and 1, the resulting final color MUST be larger than the sky color. From your screenshot, however, it looks like the cloud boundaries darken the sky. Therefore, there must be a bug in the implementation. Can you post some code?

Lutz

I check the code,you are right,it's a bug.

The result is better than before,but it still can't match with the sky color.
How to calculate the cloud color?

Share this post


Link to post
Share on other sites
The correct way to do it would be to approximate the scattering integral from the clouds to the viewer.
But the following hack might work as well, but I haven't tested it:
Draw the clouds first (in front of a black background) and then blend the sky color over the image.
The blend factor could be a constant, but then the skydome might be too dark. Try to adjust the blend factor to the clouds' alpha value to achieve less blending in front of the clouds, something like this: (bg_color is the black background plus clouds)

beta = cloud_alpha * 0.5
final = bg_color * beta + sky_color * (1-beta)

(cloud_alpha=1 is meant to be full clouds, cloud_alpha=0 should be no clouds)
Tweak the parameters until it looks good.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lutz
The correct way to do it would be to approximate the scattering integral from the clouds to the viewer.

I use mothod of the paper "Rendering Outdoor Light Scattering in Real Time" to calculate the cloud color,but the result is not good.

the left is the scattering integral result,the right is the blend of sky and cloud.
the top time is 7:30,the bottom time is 7:45.
the cloud surround the sun is not red,and the cloud in the other part of the sky is too dark.

this time is 12:00.
the problem is the left is too blue.
Anybody know why?Is it because the parameter is not appropriate?I adjust the parameter real time,these screen is the best complexion.
Is someone also implemnet this method?
Thanks.


Share this post


Link to post
Share on other sites
Well, you could try to fake it, by using some ambient value of 0.5f on the cloud to start with and then adding 0.5f * scatteringColor to it. You also might want to check out this thread on my efforts to normal map 'perlin clouds'. Maybe combining these normal maps with a bit of ambient will give you the result you are looking for.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!