Board index FlightGear Development Effects and shaders

Revisiting clouds

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Re: Revisiting clouds

Postby Thorsten » Thu Aug 23, 2018 4:27 pm

We have cloud height and relative position of a sprite with respect to cloud center in the shader as well as bottom shade (which is a proxy for cloud opacity) - I constructed a virtual cloud shape from them and computed shading based on that one.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby Isaak » Thu Aug 30, 2018 7:24 am

Wow, Thorsten, amazing work, yet again!
Isaak
 
Posts: 468
Joined: Sat Jun 04, 2011 2:52 pm
Location: Leuven, Belgium
Callsign: OO-ISA
Version: 2019.1.1
OS: Windows 10

Re: Revisiting clouds

Postby Thorsten » Tue Sep 04, 2018 12:45 pm

Some of the weird rainbowy scattering on ice on the Cirrus clouds:

Image

Image
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby Dave B » Wed Sep 05, 2018 3:58 pm

Thorsten wrote in Wed Aug 22, 2018 4:46 pm:Some impressions from flight-testing:

Great work Thorsten, liking the results so far! After looking at your actual photo, and several of mine, appears in real life there may be a more gentle roll-off from bright edge into main cloud body?

In your very first FG image thought there was also crepuscular rays.

Old photo of mine from 10 years ago (please excuse wires, didn't want to miss the moment).
Image

Thorsten wrote in Wed Aug 22, 2018 4:46 pm:
Do you think we should be looking at procedurally generating the cloud sprites rather than relying on textures?


I suspect that may be hard to do - at least I don't know how a noise function to generate all the subtlety that's in the textures should look like.

In web examples, people often use Perlin noise - but while that looks like cloud, it doesn't really look like any particular cloud type.

So if you have some idea how a suitable noise would look like I'm all ears and think it's worth trying - but for all I like painting things with math - clouds are damn complicated.

(Actually, once we do more cloud stuff in the fragment shader, the thought crossed my mind to completely re-vamp the clouds to hand different metadata to the shaders. But I've shied away from that - clouds are too important an element of flight to break them for low performance systems...)

Please excuse if this is a silly idea, could you use pre-created basic voxel cloud shapes (created for all cloud types) to help control the bounds of the procedural maths?

Amazed several months ago just watching the overhead real-time generated and eroding clouds in NoLimits 2 demo (roller coaster simulator), clouds are possibly 2D but very random and realistic.
Dave B
 
Posts: 13
Joined: Fri May 18, 2018 3:19 pm

Re: Revisiting clouds

Postby Icecode GL » Wed Sep 05, 2018 4:10 pm

Please excuse if a silly idea, could you use basic voxel cloud shapes (created for all cloud types) to drive/control the procedural maths?


I'm not as knowledgeable as Thorsten in the weather area of FG, but I know FG internally considers each cloud to be an individual object. Voxel clouds are not individual objects, but a function whose domain is the entire continuous medium (in this case the sky). A big rewrite would be needed to accommodate such thing, and the results probably wouldn't be as good as you might expect. If this was a driving simulator it would look fantastic, but voxel clouds don't work very well when you include altitude in the equation. I can't provide a link right now, but there is a very interesting paper by DICE (the game developer) on voxel clouds.
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Revisiting clouds

Postby Thorsten » Wed Sep 05, 2018 4:25 pm

Please excuse if this is a silly idea, could you use pre-created basic voxel cloud shapes (created for all cloud types) to help control the bounds of the procedural maths?


Let's say I'm a bit concerned about GPU memory requirements for such clouds - but I'd be interested to play with them - if I had any. I have no idea how to draw such a voxel cloud, neither do I know anyone who can supply the necessary 3d textures, neither do I have an algorithm to create them.

So that's preventing even the playing around phase...

appears in real life there may be a more gentle roll-off from bright edge into main cloud body?


That's actually a parameter you can change - but as usual it has side effects, it makes some situations better but others worse. One has to be realistic - without a major re-texturing effort and possible some re-write of the cloud renderer to put in more information, this will always have some situations not perfectly handled. If you look into the shader code, you can take a look at the function which evaluates texture alpha and determines opacity from it and play with it.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby gsagostinho » Wed Sep 05, 2018 4:47 pm

Thorsten, those clouds are looking stunning! Bravo!
User avatar
gsagostinho
 
Posts: 1800
Joined: Thu Jan 15, 2015 6:27 pm
Location: London, UK

Re: Revisiting clouds

Postby Mihajlo » Wed Sep 05, 2018 5:03 pm

It seems than rendering voxel clouds has already been attempted, and since it takes one second per frame to compute them it's too expensive.
Source: https://gearnuke.com/horizon-zero-dawn- ... oudscapes/
Mihajlo
 
Posts: 53
Joined: Tue Aug 28, 2018 5:47 pm

Re: Revisiting clouds

Postby Dave B » Wed Sep 05, 2018 5:20 pm

Thanks Icecode GL for your reply, edited my reply while you were typing. Wasn't meaning voxel clouds, just their bounds to help control basic cloud shapes for the higher resolution procedural generated clouds.

Thanks Thorsten for your feedback.

Thanks Mihajlo for the info and link.

To be computationally less expensive, could something similar be done in 2 dimensions, to be used with the current engine, loosely confining a fractal within a rough cloud shape bounding box, even pre-generated allowing a larger selection of cloud formations?

Modelled steam before in Blender (before Cycles was able to render volumes), not tried clouds, will preform some experiments.
Dave B
 
Posts: 13
Joined: Fri May 18, 2018 3:19 pm

Re: Revisiting clouds

Postby Thorsten » Wed Sep 05, 2018 5:24 pm

loosely confining a fractal within a rough cloud shape bounding box, even pre-generated allowing a larger selection of cloud formations?


We currently do clouds by putting a pre-generated (in this case by simple photography...) stack of textures into a rough cloud shape bounding box... (aka, I'm not getting the difference you have in mind).

'fractal' is a nice word - but what is the actual function you evaluate to get the structure of a Cumulus cloud, how does it differ from the function to get the more structured Stratus types? I have no idea.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby Dave B » Wed Sep 05, 2018 5:50 pm

Thorsten wrote in Wed Sep 05, 2018 5:24 pm:We currently do clouds by putting a pre-generated (in this case by simple photography...) stack of textures into a rough cloud shape bounding box... (aka, I'm not getting the difference you have in mind).

'fractal' is a nice word - but what is the actual function you evaluate to get the structure of a Cumulus cloud, how does it differ from the function to get the more structured Stratus types? I have no idea.

Ah, good point, and excellent questions, imagine that requires extensive mathematical knowledge to preform complex physics simulations. On a rudimentary level, when created steam in Blender modelled the shape by hand, then created a shader, while end result looked realistic realise its a great deal simpler than cloud formations.
Dave B
 
Posts: 13
Joined: Fri May 18, 2018 3:19 pm

Re: Revisiting clouds

Postby Thorsten » Wed Sep 05, 2018 7:12 pm

Modulated 3d Perlin noise certainly works fine for some cloud types (and that's what the examples found in the web often seem to be), but that leaves the rest of the clouds still undone.

Understanding the physics doesn't really help you - because the computation is too slow. It's a purely artistic optimization problem - find a function that evaluates fast enough but gives a result that looks similar enough.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby Icecode GL » Wed Sep 05, 2018 11:29 pm

It seems than rendering voxel clouds has already been attempted, and since it takes one second per frame to compute them it's too expensive.
Source: https://gearnuke.com/horizon-zero-dawn- ... oudscapes/


Well that's some new and interesting stuff. They are ray marching the clouds from some fancy 3D noise functions as a post processing effect. I guess this answers Thorsten's question, this is how these functions look like (page 33 onward of this document). They even use a "height signal" to modulate the cloud shape and get most cloud types, from stratocumulus to cirrus clouds.

The cloud scattering color can even be more easily calculated with ray marching since you know exactly how much distance the ray has traveled inside the cloud, so for each ray march step you just need to construct another ray that goes to the Sun and get the light ray's depth. With the depth you can apply those fancy phase functions or whatever Thorsten is using for his clouds. :) And the best thing, it's all procedural and in screen space. If any cloud type is stubborn and doesn't want to get ray marched, we can still fallback to textures, specially for the flat looking ones like cirrus clouds.

Looks very feasible and interesting, wish I had the time now to dig deeper.
Icecode GL
 
Posts: 542
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: Revisiting clouds

Postby Thorsten » Thu Sep 06, 2018 4:37 am

Looks very feasible and interesting, wish I had the time now to dig deeper.


Can we settle for 'possibly feasible'? Offhand I can see about a dozen things which might require rather substantial architecture changes to how we organize the work...

But maybe we can just study some of the techniques in a simpler setup - try to make a box in the sky and see whether we can arrange the described noise such that it looks like a single cloud.

Then decide how to proceed.

Anyway - compositor first.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am

Re: Revisiting clouds

Postby Mihajlo » Thu Sep 06, 2018 12:08 pm

If/when you decide to pursue this further there is a video of a guy who managed to do this by using GLSL, although it's not a perfect implementation and by learning from this forum:
https://www.gamedev.net/forums/topic/68 ... ud-system/
https://www.youtube.com/watch?v=s23wrmbtMWQ
Mihajlo
 
Posts: 53
Joined: Tue Aug 28, 2018 5:47 pm

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest