feat(renderer): improve IBL with Hosek-Wilkie sky, SH irradiance, GPU BRDF LUT
- Hosek-Wilkie inspired procedural sky (Rayleigh/Mie scattering, sun disk) - L2 Spherical Harmonics irradiance (9 coefficients, CPU computation) - SH evaluation in shader replaces sample_environment for diffuse IBL - GPU compute BRDF LUT (Rg16Float, higher precision than CPU Rgba8Unorm) - SkyParams (sun_direction, turbidity) in ShadowUniform Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -417,6 +417,9 @@ impl ApplicationHandler for DeferredDemoApp {
|
||||
shadow_map_size: 0.0,
|
||||
shadow_bias: 0.0,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer = gpu.device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Shadow Uniform Buffer"),
|
||||
|
||||
@@ -211,6 +211,9 @@ impl ApplicationHandler for IblDemoApp {
|
||||
shadow_map_size: 0.0,
|
||||
shadow_bias: 0.0,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer = gpu.device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Shadow Uniform Buffer"),
|
||||
|
||||
@@ -222,6 +222,9 @@ impl ApplicationHandler for MultiLightApp {
|
||||
shadow_map_size: 0.0,
|
||||
shadow_bias: 0.0,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer = gpu.device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Shadow Uniform Buffer"),
|
||||
|
||||
@@ -207,6 +207,9 @@ impl ApplicationHandler for PbrDemoApp {
|
||||
shadow_map_size: 0.0,
|
||||
shadow_bias: 0.0,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer = gpu.device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Shadow Uniform Buffer"),
|
||||
|
||||
@@ -258,6 +258,9 @@ impl ApplicationHandler for ShadowDemoApp {
|
||||
shadow_map_size: SHADOW_MAP_SIZE as f32,
|
||||
shadow_bias: 0.005,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer = gpu.device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("Shadow Uniform Buffer"),
|
||||
@@ -483,6 +486,9 @@ impl ApplicationHandler for ShadowDemoApp {
|
||||
shadow_map_size: SHADOW_MAP_SIZE as f32,
|
||||
shadow_bias: 0.005,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
state.gpu.queue.write_buffer(
|
||||
&state.shadow_uniform_buffer,
|
||||
|
||||
@@ -267,6 +267,9 @@ impl ApplicationHandler for SurvivorApp {
|
||||
shadow_map_size: SHADOW_MAP_SIZE as f32,
|
||||
shadow_bias: 0.005,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
let shadow_uniform_buffer =
|
||||
gpu.device
|
||||
@@ -595,6 +598,9 @@ impl ApplicationHandler for SurvivorApp {
|
||||
shadow_map_size: SHADOW_MAP_SIZE as f32,
|
||||
shadow_bias: 0.005,
|
||||
_padding: [0.0; 2],
|
||||
sun_direction: [0.5, -0.7, 0.5],
|
||||
turbidity: 3.0,
|
||||
sh_coefficients: [[0.0; 4]; 7],
|
||||
};
|
||||
state.gpu.queue.write_buffer(
|
||||
&state.shadow_uniform_buffer,
|
||||
|
||||
Reference in New Issue
Block a user