Geometry and Compute Shaders

I wonder how the performance will look with lighting samples included.

Btw, there’s also a way to ‘fake’ the lighting. Or maybe use yet another LUT in some way. I’ll probably look into these two once I’ll get back to work on sky.

Also another nice feature of the lib that would be nice would be the ability to bake a sky into skybox. That way even very expensive sky effects could be rendered or pre-rendered. Would be useful for games which do not require animated clouds/day-night cycle etc.


That looks really nice already.


this already looks nice, like was said, but you are right, performance could be better.

I’m going to remove the atmospheric scattering shader I’m currently using since it is cutting the fps in half. I’m very curious about the lighting samples too.

LUT for the lighting is likely doable. There’s probably a tricky way to do it with 3d texture. I’ll have to think about it too.

Pre-rendered skybox texturing is a great idea! I made a fighting game a long way back that would have been a great use case for a randomly generated static sky box.

i would also think about some idea like:

make PBR envmap slowly blur-change from one generated envmap of skybox to other.

for example each 10 seconds.

then PBR models would look like clouds move on them too.

but idk how to make this “animated-blur-change” between envmaps properly. anyway its just an idea that would work really nice with all this dynamic skybox libs. (best if prerendered)

I swapped out the atmospheric scattering shader for a cheaper one, and now FPS is over 100 FPS on my old GTX 660, (with no light samples). I have applied cloud detail and sheering effect. Still working on improving cloud shaping and coverage. Here is a video of current state

I’ll post another vid once lighting is finished and commit to github then.


Looks great :slight_smile: make it customizable much and done

btw. looking at assasyn creed odyssey and looking yours.
i think if would use 2 layers (high atmosphere and low) + more disproportion for big clouds and small clouds and clear sky, it could look really awesome.

Because now your clouds are very “plain”. not sure if you already give possibility to make “group” of clouds where other places are clear sky.

But i just wanted to mention that it look nice when done this way.

Also i understand it would be possible make this clouds as “sphere dome mesh shader” to even on far horizon there could be clouds.

i dont want say it to look same ofc, because its too hard :smiley: but i think you could do something similar to what they have. ( i know it dont count horizontal cloud view, but vertical view could look nice too)

reference image:

1 Like

It looks gorgeous!

Have you already tried to render the clouds at a lower resolution?
Fuzzy things are very suitable for down sampling. Though, it might require a depth resolve pass.
Rendering for example at 1/6 of the resolution will take 36 times less rays and might give you room for the light samples (which could be precomputed at a lower fps and stored in a 3d texture).

I have not tried lowing resolution yet. There are some other optimizations I would like to try first. I guess this thread started by talking about compute shaders, and I suspect I will end up needing to parallelize the light sampling in a compute shader. This one of the optimizations discussed in the Nubis video above.

@oxplay2 yes, a cloudscape like that is the goal! It could still be a quad, just the cloud path calculation would need to be adjusted. The clouds don’t look natural in as far as perspective, but boy do they look pretty!

1 Like

if you will achieve it at least some similar to Assasin Creed one, then if i could, i would give you 10000 likes :star_struck:

Well not quite like Assassins Creed yet, but I have made some good progress. I changed my approach a good bit. Using a signal from the weather texture to signal altitude allows clouds to be rendered at different heights in the atmosphere. I thing that is how they get that look. I still need to work on lighting. As you can see the color doesn’t quite match at the moment, but I am happy with the progress.


you are right with everything :slight_smile:

but it looks much better than it was, if you keep adding improvements, it will really look like Assasyn Creed one :smiley:

like you said, it require different heights of atmosphere and better lightning. (and allow much different height of clouds in some cluster)

current clouds looks like they have almost no “height”, idk if you can just add more layers to it, but would be nice having effect of more “vertical” cloud


The height and altitude are controlled by the depth of the atmosphere and the Green and Blue Channels in the weather texture. Green controls the height, Blue controls the altitude. There is also a scalar in the shader to control how far on the horizon to draw the clouds, as well as wind and turbulence settings. I think it would be possible to get big puffy clouds now, but I have not tried. I generate my weather textures and then adjust them in photoshop. For example, here is one that has different levels of clouds with whispy clouds flowing from one altitude level to another. Looks pretty cool animated. I will take another video soon, but this will all be on github soon too.


For some extra detail for free, if you don’t do it already, have the red channel(density) contain some noise eg perlin.

In my implementation, green and blue control the distance of bottom/top edge of cloud from the average cloud altitude. Thus, a weather map with full green, blue channels would produce the thickest clouds.

Yep! I have not put much time into the weather maps at this point, but I do generate them using tilable perlin noise. I am experimenting with that now.

I was initially going to follow something like wht you have with the G/B channels, but then I found this paper and decided to implement the height/altitude signals the same way. There is a pretty slick parabolic function defined in section 5.4

1 Like

wow, in above screenshot i can really feel depth of this clouds :slight_smile: nice work!

1 Like

I think I am getting even a little closer to that look. I decided to scrap most of what I was using for the cloud path (I was using the seven sky cloud path LUT) and moved to a spherical horizon intersection. While not 100% realistic, I like this approach better for a few reasons. I definitely think the height and shape of the clouds is more well defined this way, and distinction between cloud decks is more pronounced too.

This model has 1-6 atmosphere levels (cloud decks) and heights can be adjusted to span over however many levels required. I still have not incorporated any lighting. (currently system just uses higher density = higher darkness).

This is my todo list before release:
Ambient Lighting
In/Out Light Scattering
Inter-cloud shadows.


Looking really good already.


It looks awesome already! Really now i feel it like realistic clouds. Great work! :ok_hand:

i cant wait to see how it will work with light scattering / Inter-cloud shadows too :slight_smile:

have you thought about day/night cycle? i wonder how will it look with stars on sky.

1 Like

I have made good progress with the lighting. I have not really worked on day/night cycle or any of the other features you would want for a full fledged “Sky system.” I feel like that is pretty game specific, and I was hoping to get this out as one shader, more of a starting point than something that is trying to do too much.

For example, the side by side below is one simple tweek to the blending in the shader and yields very different results. Neither of these have phase applied either. Some games combine the phase function at several different eccentricities to get forward scatter light to get a certain look. I think this might be better to comment in the shader, but not apply. It really depends on the game.

So at this point, the lighting model is pretty much done. I am finishing up intercloud shadows now but as expected the performance is not great (like 55ms per frame not great). The results look pretty good to me though, so I would like to ask for suggestions/help with optimization, as there may be some things I can do pretty easily in jMonkey.

In one of the documents I linked, they mention building a full frame over several frames. I believe they use two render targets for this and flip them as they build the full view, but I am not 100% sure on that. The video I linked appears to render the screen in segments for performance. This I would assume was done with a compute shader. Does anyone have input or a suggestion for what might be able to be done without a compute shader? I am leaning towards the render target.