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.

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.

Create a custom theme





