Skip to content

Commit 611434b

Browse files
committed
[sky] new volumetric clouds
1 parent e3b6899 commit 611434b

17 files changed

Lines changed: 864 additions & 1059 deletions

data/shaders/common_resources.hlsl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ Texture3D tex3d : register(t13);
4949
// noise
5050
Texture2D tex_perlin : register(t14);
5151

52-
// volumetric cloud 3D noise textures
53-
Texture3D tex3d_cloud_shape : register(t20); // 128^3 Perlin-Worley + Worley FBM
54-
Texture3D tex3d_cloud_detail : register(t21); // 32^3 high-frequency detail
5552
// restir reservoir textures (shared across path tracing, temporal, and spatial passes)
5653
// kept contiguous so a single loop can bind all six slots starting from tex_reservoir_prev0
5754
// the 6th slot carries the source primary g-buffer for the chosen path so the temporal and

data/shaders/light.hlsl

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
#include "light_cluster.hlsl"
2828
//============================
2929

30-
// Cloud shadow map sampling
31-
// tex3 is bound as the cloud shadow map in Pass_Light
32-
float sample_cloud_shadow(float3 world_pos)
33-
{
34-
// skip if cloud shadows are disabled
35-
if (buffer_frame.cloud_shadows <= 0.0 || buffer_frame.cloud_coverage <= 0.0)
36-
return 1.0;
37-
38-
// cloud shadow map covers 10km x 10km area
39-
float shadow_map_size = 10000.0;
40-
41-
// get shadow map dimensions for texel size calculation
42-
float2 shadow_dims;
43-
tex3.GetDimensions(shadow_dims.x, shadow_dims.y);
44-
float texel_size = shadow_map_size / shadow_dims.x;
45-
46-
// snap center to texel grid (must match cloud_shadow.hlsl)
47-
float2 snapped_center = floor(buffer_frame.camera_position.xz / texel_size) * texel_size;
48-
49-
float2 relative_pos = world_pos.xz - snapped_center;
50-
float2 uv = relative_pos / shadow_map_size + 0.5;
51-
52-
// out of bounds check
53-
if (any(uv < 0.0) || any(uv > 1.0))
54-
return 1.0;
55-
56-
// sample cloud shadow (tex3 is the cloud shadow map)
57-
float shadow = tex3.SampleLevel(GET_SAMPLER(sampler_bilinear_clamp), uv, 0).r;
58-
59-
return shadow;
60-
}
61-
6230
// ray traced shadow sampling
6331
// tex4 is bound as the ray traced shadow texture in Pass_Light
6432
float sample_ray_traced_shadow(float2 uv)
@@ -367,14 +335,6 @@ void evaluate_light(
367335
light.radiance *= L_shadow;
368336
}
369337

370-
// cloud shadows apply to directional lights regardless of shadow method
371-
if (light.is_directional())
372-
{
373-
float cloud_shadow = sample_cloud_shadow(surface.position);
374-
L_shadow = min(L_shadow, cloud_shadow);
375-
light.radiance *= cloud_shadow;
376-
}
377-
378338
AngularInfo angular_info;
379339
angular_info.Build(light, surface);
380340

data/shaders/shared_buffers.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,14 @@ struct FrameBufferData
100100
SHARED_FLOAT3 camera_right;
101101
SHARED_FLOAT camera_exposure;
102102

103-
// clouds
104-
SHARED_FLOAT cloud_coverage;
105-
SHARED_FLOAT cloud_shadows;
106103
SHARED_FLOAT restir_pt_light_count;
107104
// emissive triangle nee pool count, set by Renderer::UpdateAccelerationStructures, when
108105
// zero the restir initial ris pass falls back to the brdf + analytical light strategies
109106
// only, when non zero a third strategy area samples a random emissive triangle and the
110107
// balance heuristic mis denominator includes its solid angle pdf, see restir_pt.hlsl
111108
SHARED_FLOAT restir_pt_emissive_tri_count;
109+
SHARED_FLOAT padding_a;
110+
SHARED_FLOAT padding_b;
112111

113112
// vr stereo - right eye matrices (left eye uses the primary matrices above)
114113
SHARED_MATRIX view_right;

data/shaders/sky/cloud_noise.hlsl

Lines changed: 0 additions & 136 deletions
This file was deleted.

data/shaders/sky/cloud_shadow.hlsl

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)