Geometry and Compute Shaders

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.

7 Likes

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.

8 Likes

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

2 Likes

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.

4 Likes

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.
Optimization

12 Likes

Looking really good already.

2 Likes

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.

4 Likes

I believe they use two render targets for this and flip them as they build the full view

im really not sure if it will help, since its more related to filters, but @RiccardoBlb is doing new render pipeline that could help maybe. (since can use custom input textures/etc and use output where need)

Anyway imo this looks already great even without this features :slight_smile:

btw. so you do just a shader? i told about day/night because i thought you also do Java class to operate on shader :slight_smile: but if you dont then everything can be done via user side just using shader itself.

Thanks! The problem is it takes at least 128 ray march steps to get a nice detailed looking cloud and without optimization the render time is too slow

Yes, there is a java class with many different parameters that can be set. The clouds can look detailed, or cartoon, or even blocky depending on the settings and the weather texture used. I just don’t have much for the sky at this point. It can skybox or another shader. I wasn’t planning to implement a complete sky system, but maybe I will.

1 Like

you have some github for it, or still doing without it for now?

i would really like to try it (if you gonna make it public) :slight_smile:

I don’t have one yet. Hopefully I will have time to put something out there this weekend. I will comment here when I do.

2 Likes