Jump to content
  • Advertisement
Sign in to follow this  
SiS-Shadowman

cloud rendering

This topic is 4354 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 know, here are alot of threads about cloud rendering, but i haven't found a single post wich explicitly explains how to shade the clouds. finally i've managed to write a cloud generator ( using perlin noise, done on the cpu ). the created texture then is just mapped on a curved skyplane ( the texture defines the alpha channel ). ( http://www.shadowman-works.de/forum/files/2/clouds1.png & http://www.shadowman-works.de/forum/files/2/clouds2.png ) but how can i shade the clouds? can somebody explain me how this could be done? i think a simple model ( taking into account the density of the clouds and the color of the sun ) would be enough.

Share this post


Link to post
Share on other sites
Advertisement
as long as i can see these articles cover clouds for a flight sim or something similar. the cloud systems are all particle based and their lighting formulas are much more complicated as for a "static" sky, aren't they? is there a possibility to adapt them for my ( and many others ) method?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You never told us what you wanted to do exactly, we're not mind readers :)

Share this post


Link to post
Share on other sites
i'm very sorry.
i thought that my explaination was enough. i just need a formula or some hints to be able to shade a skyplane, no volumetric clouds or something like that...

Share this post


Link to post
Share on other sites
the thread is interesting, but i can't get it right. some people speak of raytracing a ray from the sun trough the cloud => how am i supposed to do that o.O

another thing that is missing: how do i calculate the density of a cloud? should i just take the r g b value of the cloudmap, multiply it and this is its density?

the last thing that is really bugged: i want to light my clouds, not with the standart paralell lighting method, but with the sun as a point light.


Out.Pos = mul(Pos, matWorldViewProjection);

// Sunrays from pointlight
// lightDir is the Position of the Sun on the Skydome
Out.hemi = saturate(dot(normalize(lightDir - Out.Pos), normalize(mul(Normal, matRotation))));



the funny thing is that my clouds change color, depending how the camera is aligned to them *g
i have no idea why this is happening, since lightDir is definately the position of the sun. the rotation of the cam doesn't even appear in the code for the cloud rendering.

Share this post


Link to post
Share on other sites
You're transforming the position into clip space and then finding the vector between that and the light (which I assume is in world space). That will just give you garbage since they are in different coordinate systems. I think you would be better off lighting in world space.

Btw having a variable named 'lightDir' be the light position is kindof misleading.

Also assuming the result of mul(Normal, matRotation) is a float4 you must specify that the .xyz are being normalized and not the w as well, or you will get incorrect restults.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiS-Shadowman
the funny thing is that my clouds change color, depending how the camera is aligned to them *g
i have no idea why this is happening, since lightDir is definately the position of the sun. the rotation of the cam doesn't even appear in the code for the cloud rendering.


Try resetting the lightDir variable every frame, basically right before using it. I ran into a similar lighting problem and this fixed it for me, so I never got around to actually figuring out why my lighting changed with the camera angle... I just assumed lighting was tied to the view matrix somehow.

Share this post


Link to post
Share on other sites
Quote:
Original post by jamesw
You're transforming the position into clip space and then finding the vector between that and the light (which I assume is in world space). That will just give you garbage since they are in different coordinate systems. I think you would be better off lighting in world space.


*slap* ok, so i need to multiply the Position with the Transformation Matrix, right?

Quote:

Btw having a variable named 'lightDir' be the light position is kindof misleading.


yeah, i was just to lazy to introduce another variable for the Position of the light, since i have one shader file for the whole environment ( starbox, skydome, sun, etc... )

Quote:

Also assuming the result of mul(Normal, matRotation) is a float4 you must specify that the .xyz are being normalized and not the w as well, or you will get incorrect restults.


i don't get what you mean here. isn't the .w var uninteresting?

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!