Geometry and Compute Shaders

Yes, there is no sorting issue but there is no shading either. So it’s impossible to tell, really.

It’s the shading being on the wrong sides and/or ahead of the things in front of them that was causing the issue before.

I don’t know how I missed the PDF in the project, but wow, that is super helpful!
Curious how much performance you gained by using a lookup table for cloud path?

Haven’t done tests in numbers, but if you check SkyLutGenerator.cloudPath that amount of code would have to be executed for each fragment without the lookup table, which would be rather expensive.

I did a very basic test in SevenSky by moving the calcForSphere function to the frag shader, and there was a drop of about 7 fps. The cloudPath LUT is indeed VERY important! I am going to have to borrow that part :smiley:

I started clean in a new project and have made some decent progress (below). It still looks too much like noise IMO but it is getting close. Also, the sky shader I am using at the moment is very slow. The clouds alone render over 100fps and I am using 32 samples, although I have not started on the lighting samples yet. I should have something really nice in another week or so.

7 Likes

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.

3 Likes

That looks really nice already.

2 Likes

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.

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.

3 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

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

1 Like