cloud rendering

Started by
16 comments, last by SiS-Shadowman 17 years, 6 months ago
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.
Advertisement
Have you looked here? http://www.markmark.net/
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?
You never told us what you wanted to do exactly, we're not mind readers :)
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...
This old thread might help.
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.
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.
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.
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?

This topic is closed to new replies.

Advertisement