cloud rendering

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

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 on other sites
Have you looked here? http://www.markmark.net/

Share on other sites
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 on other sites
You never told us what you wanted to do exactly, we're not mind readers :)

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 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 SkydomeOut.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 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 on other sites
Quote:
 Original post by SiS-Shadowmanthe funny thing is that my clouds change color, depending how the camera is aligned to them *gi 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 on other sites
Quote:
 Original post by jameswYou'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?

1. 1
2. 2
3. 3
Rutin
20
4. 4
khawk
14
5. 5

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633655
• Total Posts
3013187
×