Horizon:zero Dawn Cloud System

Started by
78 comments, last by IlPresidente 5 years, 8 months ago

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]
hehe.
Advertisement

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

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.

hehe.

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

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.
    float density_height_gradient = GetDensityHeightGradientForPoint ( p , weather_data );
    
    // Apply the height function to the base cloud shape.
    base_cloud ?= density_height_gradient ;

    // 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);



d.the heightGradient


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 LerpGradient(float cloudType)
{
    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;

    return cloudGradient1 * a + cloudGradient2 * b + cloudGradient3 * c;
}

float CalculateGradient(float a, float4 gradient)
{
    return smoothstep(gradient.x, gradient.y, a) - smoothstep(gradient.z, gradient.w, a);
}


heightGradient = CalculateGradient(height, LerpGradient(cloudType);

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

@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

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!

clouds.png

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


Where are we and when are we and who are we?
How many people in how many places at how many times?

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

Code makes the man

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!

clouds.png

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.

This topic is closed to new replies.

Advertisement