Jump to content
  • Advertisement
  • entries
  • comments
  • views

More on clouds shading

Sign in to follow this  


I have improved the shading, especially in two areas:

1. Brightness: i noticed that clouds, even directly lit by sunlight, were still a bit gray. The cause was the smoothing of normals: normals of voxels inside the cloud can basically point in any direction. Smoothing the values with these normals cause a subtle decrease of brightness. Ideally i'd like to have a function that can tell if i'm fully inside the cloud or not, but this does not sound easy to write especially with the kind of data that is known at that time - so i'll stick to this trick: after the dot product is calculated, i multiplied it by a constant factor (2.5 in my case). However this had the side effect of making the dark areas of the cloud even darker, so i only applied this scale if the dot product is positive.

2. Bottom of the clouds were too dark. The gradiant function was not very well chosen, i improved it a bit since yesterday.

I am now going to work on the performance. Two areas require improvement:
- CPU calculations for billboards: i will shift these onto a vertex shader.
- sorting the particles: i will use a more efficient sort.

A well known trick can be used to sort particles in a voxel space, which requires zero work (or almost). You just need to take into account the view direction and to parse the voxel space from X negative to positive if the view direction is negative along the X axis, or vice-versa if it's positive along the X axis. Do the same for the Y and Z axis. You normally use a triple "for" loop, all that varies is if you're going to parse voxels from left to right or right to left.

I hope this trick can be used even if the cloud "surface" is curved - do not forget i plan to use this for my planet renderer, so the final cloud volume will be mapped over Earth's surface.

Once i get a decent "brute force" cloud renderer, i will start working on the impostors. I hope this will allow me to display a sky filled of clouds up to the horizon, and not just in a small space like now.

Screens below:
1. View taken under the clouds, to show the bottom shading.
2. View taken when flying inside the clouds.

Sign in to follow this  


Recommended Comments

Yes. They're generated in a voxel space and then rendered as particles/billboards. The sky needs some work (it's only a blue background at the moment). The shape of the clouds is still simple, they're all ellipsoids-like. I will try to vary the textures and the cloud shapes, it should give nicer results.


Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!