feat(renderer): add normal mapping and procedural IBL to PBR shader

- Add tangent input (location 3) and TBN computation in vertex shader
- Add normal map sampling (group 1, bindings 2-3) for tangent-space normal mapping
- Add BRDF LUT binding (group 4, bindings 0-1) for specular IBL
- Add procedural sky environment function for diffuse/specular IBL
- Replace flat ambient with split-sum IBL approximation
- Add pbr_texture_bind_group_layout (4 entries: albedo + normal)
- Add create_pbr_texture_bind_group helper and flat_normal_1x1 texture
- Update create_pbr_pipeline to accept ibl_layout parameter (group 4)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 21:28:32 +09:00
parent ea8af38263
commit 5232552aa4
4 changed files with 200 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ pub fn create_pbr_pipeline(
texture_layout: &wgpu::BindGroupLayout,
material_layout: &wgpu::BindGroupLayout,
shadow_layout: &wgpu::BindGroupLayout,
ibl_layout: &wgpu::BindGroupLayout,
) -> wgpu::RenderPipeline {
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
label: Some("PBR Shader"),
@@ -16,7 +17,7 @@ pub fn create_pbr_pipeline(
let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: Some("PBR Pipeline Layout"),
bind_group_layouts: &[camera_light_layout, texture_layout, material_layout, shadow_layout],
bind_group_layouts: &[camera_light_layout, texture_layout, material_layout, shadow_layout, ibl_layout],
immediate_size: 0,
});