# Horizon:zero Dawn Cloud System

## 63 posts in this topic

What is the performance you guys are getting out of your result?

Ray marching seems quite expensive still, is that right?
0

##### Share on other sites

What is the performance you guys are getting out of your result?

Ray marching seems quite expensive still, is that right?

Super expensive :)

In the Zero Dawn presentation, they mention that they only calculate 1/16th of the rays every frame, and temporally re-project the rest of them using results from previous frames.

That's equivalent to only rendering at 480x270 per frame for a 1080p output, and it still takes them a few milliseconds.

2

##### Share on other sites

What is the performance you guys are getting out of your result?

Ray marching seems quite expensive still, is that right?

Super expensive :)

In the Zero Dawn presentation, they mention that they only calculate 1/16th of the rays every frame, and temporally re-project the rest of them using results from previous frames.

That's equivalent to only rendering at 480x270 per frame for a 1080p output, and it still takes them a few milliseconds.

Optimizing for when you even start marching, with some sort of ultra simple proxy like signed distance fields/2d cloud coverage map/etc. should also help a lot. But temporal reprojection and supersampling are basically required.

0

##### Share on other sites

What is the performance you guys are getting out of your result?

Ray marching seems quite expensive still, is that right?

Super expensive :)

In the Zero Dawn presentation, they mention that they only calculate 1/16th of the rays every frame, and temporally re-project the rest of them using results from previous frames.

That's equivalent to only rendering at 480x270 per frame for a 1080p output, and it still takes them a few milliseconds.

Optimizing for when you even start marching, with some sort of ultra simple proxy like signed distance fields/2d cloud coverage map/etc. should also help a lot. But temporal reprojection and supersampling are basically required.

when coverage = 0 don't calculate light?

0

##### Share on other sites

Yep it is expensive, around 1.4-2.1ms on a gtx970 @1/16th FullHD resolution.

Optimisations so far, early out on high opacity, no expensive calclation on coverage  == 0 , and no full quality light-samples on opacity > 60%

and a carefully tweaked scale. Thought on a signed distance field aswell, but that eliminates the nice property of realtime coverage/shape changes

0

##### Share on other sites

ryokeen, how to use weather type and height to adjust the coverage?

thanks.

i try some method, watch from top, the result is not too bad.

[sharedmedia=gallery:images:7604]

but watch from the bottom, the result is bad.

[sharedmedia=gallery:images:7605]
0

##### Share on other sites

With the height from the weatherdata i compute the fade_in/fade_out values very similiar to how they do it in the article.

Then somewhere i have

lCoverage = 1.0-cloudType.r*fade_out*fade_in;


Where clodeType is the weatherdata at the current sample position. Try just the same you did for the cloudtops at a smaller heightscale for the bottom, that should help a lot.

Also i scale the final cloud value by fade_in to make it a bit smoother

0

##### Share on other sites

Ryokeen,

I get enough detail when watch from top:

[sharedmedia=gallery:images:7619]

but when watch from bottom, the detail get fuzzy:
[sharedmedia=gallery:images:7620]

i think the reason is the edge of cloud is not very steep.
can you post a screenshot from the top view?
thanks.

0

##### Share on other sites

ChenA , can you post your code so that we can see what your doing?

0

##### Share on other sites

ChenA , can you post your code so that we can see what your doing?

thanks.

1.weather texture, i use the horizon zero dawn's default weather texture, mapping method use plane projection.

[sharedmedia=gallery:images:7621]

2.density composite algorithm use gpu pro 7 algorithm with some modify.
gpu pro 7 algorithm:
// Fractional value for sample position in the cloud layer .
float GetHeightFractionForPoint ( float3 inPosition , float2 inCloudMinMax )
{
// Get global fractional position in cloud zone .
float height_fraction = (inPosition.z ? inCloudMinMax.x ) / ( inCloudMinMax.y ? inCloudMinMax.x ) ;
return saturate ( height_fraction ) ;
}

// Utility function that maps a value from one range to another .
float Remap ( float original_value , float original_min , float original_max , float new_min , float new_max )
{
return new_min + ( ( ( original_value ? original_min) / ( original_max ? original_min ) ) ? ( new_max ? new_min ) );
}

float SampleCloudDensity ( float3 p , float3 weather_data )
{
// Read the low?frequency Perlin?Worley and Worley noises.
float4 low_frequency_noises = tex3Dlod ( Cloud3DNoiseTextureA , Cloud3DNoiseSamplerA , float4 ( p , mip_level) ).rgba;

// Build an FBM out of the low frequency Worley noises
// that can be used to add detail to the low?frequency
// Perlin?Worley noise.
float low_freq_FBM = ( low_frequency_noises.g ? 0.625 )
+ ( low_frequency_noises.b ? 0.25 )
+ ( low_frequency_noises.a ? 0.125 );

// define the base cloud shape by dilating it with the
// low?frequency FBM made of Worley noise.
float base_cloud = Remap ( low_frequency_noises.r , ?( 1.0 ? low_freq_FBM ) , 1 .0 , 0 .0 , 1 .0 );

// Get the density?height gradient using the density height
// function explained in Section 4.3.2.

// Apply the height function to the base cloud shape.

// Cloud coverage is stored in weather data’s red channel.
float cloud_coverage = weather_data.r;

// Use remap to apply the cloud coverage attribute.
float base_cloud_with_coverage = Remap ( base_cloud , cloud_coverage, 1. 0 , 0. 0 , 1.0);

// Multiply the result by the cloud coverage attribute so
// that smaller clouds are lighter and more aesthetically
// pleasing.
base_cloud_with_coverage ?= cloud_coverage;

// Add some turbulence to bottoms of clouds.
p.xy += curl_noise.xy ? ( 1 . 0 ? height_fraction );

// Sample high?frequency noises.
float3 high_frequency_noises = tex3Dlod ( Cloud3DNoiseTextureB , Cloud3DNoiseSamplerB , float4 ( p ? 0.1 , mip_level) ).rgb;

// Build?high frequency Worley noise FBM.
float high_freq_FBM = ( high_frequency_noises.r ? 0.625 )
+ ( high_frequency_noises.g ? 0.25 )
+ ( high_frequency_noises.b ? 0.125 );

// Get the height fraction for use with blending noise types
// over height.
float height_fraction = GetHeightFractionForPoint ( p , inCloudMinMax );

// Transition from wispy shapes to billowy shapes over height.
float high_freq_noise_modifier = mix ( high_freq_FBM ,
1 .0 ? high_freq_FBM , saturate ( height_fraction ? 10.0 ) );

// Erode the base cloud shape with the distorted
// high?frequency Worley noises.
float final_cloud = Remap ( base_cloud_with_coverage ,
high_freq_noise_modifier ? 0.2 , 1.0 , 0.0 , 1.0 );

return final_cloud;
}


modify:

a.worley noise

//float base_cloud = Remap(low_frequency_noises.r, ?(1.0f - low_freq_FBM), 1.0 , 0.0 , 1.0);

//i think this remap's effect is increase base_cloud value, get more cauliflower shapes,
//and the noisetexture1 gba is the inverted worley, so shoud use -(low_freq_FBM)
float base_cloud = Remap(low_frequency_noises.r, ?(low_freq_FBM)*scale, 1.0 , 0.0 , 1.0);



b.empty sky regions

//i add a remap to get empty sky regions, threshold control the empty sky regions,
//maxValue control smoothness
base_cloud = Remap(base_cloud, threshold, maxValue, 0.0f, 1.0f);

//the gpu pro 7 don't use this, but i don't know how they get empty sky regions.
//they just use first remap and multiply heightGradient to get the base noise cloud shapes
//i use these two operation can't get empty sky regions


the gpu pro 7 base noise cloud shapes:

[sharedmedia=gallery:images:7622]
it has steep edge.

c.coverage
//float base_cloud_with_coverage = Remap(base_cloud, cloud_coverage, 1.0, 0.0, 1.0);

//it seems the gpu pro7 use coverage to control the cloud's thinkness, more coverage,
more thick, so i use the below:
float base_cloud_with_coverage = Remap(base_cloud, saturate((height * scale) / cloud_coverage), 1.0, 0.0, 1.0);



float4 cloudGradient1 = float4(0, 0.07, 0.08, 0.15);
float4 cloudGradient2 = float4(0, 0.2, 0.42, 0.6);
float4 cloudGradient3 = float4(0, 0.08, 0.75, 1);

{
float a = 1.0f - saturate(cloudType / 0.5f);
float b = 1.0f - abs(cloudType - 0.5f) * 2.0f;
float c = saturate(cloudType - 0.5f) * 2.0f;

}

{
}



gpu pro 7 said that:

A value of 0.0 indicates stratus, 0.5 indicates stratocumulus, and 1.0 indicates cumulus clouds.

but see this picture

[sharedmedia=gallery:images:7623]
it seems that 1.0f is cumulonimbus.
Edited by ChenA
1

##### Share on other sites

@ChenA I'm not sure how they even got the shape working. I get at best some very diffuse unshapeable cloud areas with their Remap approach. That's why i'm still sticking to my own way.
For the top view, i have to change the shader a bit for that to work, since i optimized the cloud layer to be always above the camera. Makes more sense in Earth Special Forces (players there don't get that high). Will do that when i have time on weekend

0

##### Share on other sites

recently  i read the gpu pro 7 article <>, i want to implement a volumetric cloud system myself.
Recently I read you thread, and it really made me want to implement a volumetric cloud system myself! :D

This is running at 0.2fps, using brute-force code (no textures). Now I have to optimize it using all the knowledge in this thread. Thanks for the inspiration!

0

##### Share on other sites

Hehe yeah, this thread inspired me too. Couldn't force myself to rework my rendering system into something more flexible and after a week I'm done with a nice way to render such effects easily so I will also have a try. Stay tuned for questions coming from me soon :P

0

##### Share on other sites

@Hodgman you planning on sharing an application with your findings ?

0

##### Share on other sites

recently  i read the gpu pro 7 article <>, i want to implement a volumetric cloud system myself.
Recently I read you thread, and it really made me want to implement a volumetric cloud system myself! :D

This is running at 0.2fps, using brute-force code (no textures). Now I have to optimize it using all the knowledge in this thread. Thanks for the inspiration!

Well it certainly looks pretty, so that goal is accomplished! And by all means, grab DICE's take on this stuff here: http://blog.selfshadow.com/publications/s2016-shading-course/

Nothing dramatically changed, but some nice findings none the less.

Edit- Also, thinking about this, Naughty Dog had a nice hack with Uncharted called "mip fog". Which was just the skydome mip-mapped and applied as a kind of "fog texture" lerping between high mips for distant objects to low res for closer objects. It's a hacky way to do scattering and get your "fog" to seemlessly blending into your sky, and I'm sure you could come up with a way to do custom mips that hews closer to physical scattering.

But with volumetric clouds you need a way for close in scattering (below the cloud layers) to match the scattering from indirect light, which would be dominated by the skydome outdoors. So you could do the same thing here, grab a progressive/time sliced cubemap of the skydome (X by X pixel tiles per frame, lerp between previous tile to new tile over time to avoid worst artefacts at tile edges?) and then you could mip the skydome cubemap easy enough to do the same thing.

Edited by Frenetic Pony
1

##### Share on other sites

@Hodgman you planning on sharing an application with your findings ?

Sure. The quick prototype that that picture is from is a shadertoy :D
https://www.shadertoy.com/view/Mt33zj The code is terrible and terribly inefficient though!

I started by stealing this atmospheric scattering shader by valentingalea (which is based on this article), stealing some noise functions from iq, and adding a cloud layer based on what I could remember from reading this thread.

the shadertoy is not very convenient, i create a prototype use unity.

the cloud shape is not very pleasing.

we can implement it together.

1

##### Share on other sites

Recently this weekend i implemented the volumetric clouds as described in the gpupro7 book, vary much similar to what you guys have been showing here in this thread, however im having trouble with generating the noise textures...

Looking at your project ChenA I think your noise textures are also incorrect?

0

##### Share on other sites

Recently this weekend i implemented the volumetric clouds as described in the gpupro7 book, vary much similar to what you guys have been showing here in this thread, however im having trouble with generating the noise textures...

Looking at your project ChenA I think your noise textures are also incorrect?

i think the #35's noise texture is very simlar to gpu pro 7's noise texture.

you mean the perlin-worley noise?can you give a detail description of the incorrect?

base noise:
[sharedmedia=gallery:images:7682]

detail noise:
[sharedmedia=gallery:images:7683]

up is my noise, bottom is gpu pro 7 noise.

can you post a screenshot of your result?

thanks.

Edited by ChenA
0

##### Share on other sites

Hi Everyone. Andrew Schneider here.

It is really exciting to see all of this progress in our narrow field of realtime volumetric cloudscapes. A lot of our approach to cloud modeling relies on the noise textures, indeed. The examples above look very close to our cloud model - and better in some respects. Awesome.

We purposefully left code like sphere intersection out of the GPU pro article because it can be found easily. Graphics Gems (1998) P. 388, for example. The weather texture is also something we didn't elaborate on because it is just the result of combining several types of scrolling noise. We even hand paint some.

Hey Andrew, loved the gpu pro article, any plans to put together a small demo?

0

##### Share on other sites

You can also find both the complete source code from Bitsquid here:

http://bitsquid.blogspot.com/2016/07/volumetric-clouds.html

Or a more working version that you can try on Unity here:

http://kode80.com/blog/2016/04/11/kode80-clouds-for-unity3d/index.html

The unity package contains everything, from source code to editing the weather maps.

These could be a good peek into this technique!

And again, thanks to Andrew that shared his (their) tech with us!

2

##### Share on other sites

Sorry for the late reply. We are hard at work on Horizon.

I am looking into the best way to answer a lot of the questions that we have been getting over the past year or so. I need to discuss this with my colleages.

Please stand by until after you see Horizon on the shelves.

Best,

Andrew

0

##### Share on other sites

Hi Everyone. Andrew Schneider here.

It is really exciting to see all of this progress in our narrow field of realtime volumetric cloudscapes. A lot of our approach to cloud modeling relies on the noise textures, indeed. The examples above look very close to our cloud model - and better in some respects. Awesome.

We purposefully left code like sphere intersection out of the GPU pro article because it can be found easily. Graphics Gems (1998) P. 388, for example. The weather texture is also something we didn't elaborate on because it is just the result of combining several types of scrolling noise. We even hand paint some.

I implemented clouds in Final Fantasy XV at Square Enix based on your papers, with slight modifications.
In fact, I was working on that when a few from your studio visited us in Tokyo (perhaps you were among them?). I had the basics of your clouds going on my monitor when your guys walked by, but no one took the time to point out that my clouds were based off your work.
Oh well! Look for them in Final Fantasy XV!

L. Spiro
0

##### Share on other sites

Hi Everyone. Andrew Schneider here.

It is really exciting to see all of this progress in our narrow field of realtime volumetric cloudscapes. A lot of our approach to cloud modeling relies on the noise textures, indeed. The examples above look very close to our cloud model - and better in some respects. Awesome.

We purposefully left code like sphere intersection out of the GPU pro article because it can be found easily. Graphics Gems (1998) P. 388, for example. The weather texture is also something we didn't elaborate on because it is just the result of combining several types of scrolling noise. We even hand paint some.

I implemented clouds in Final Fantasy XV at Square Enix based on your papers, with slight modifications.
In fact, I was working on that when a few from your studio visited us in Tokyo (perhaps you were among them?). I had the basics of your clouds going on my monitor when your guys walked by, but no one took the time to point out that my clouds were based off your work.
Oh well! Look for them in Final Fantasy XV!

L. Spiro

Feel free to contribute any tips or improvements! this is quickly becoming the go to place for cloud rendering. The sky's look particularity nice in XV!

Sorry for the late reply. We are hard at work on Horizon.

I am looking into the best way to answer a lot of the questions that we have been getting over the past year or so. I need to discuss this with my colleages.

Please stand by until after you see Horizon on the shelves.

Best,

Andrew

No rush, Horizon looks absolutely gorgeous. Look forward to seeing whatever you come up with post Horizon release.

0

## Create an account

Register a new account