feat(renderer): add ORM and emissive texture map support to PBR pipeline
- Extended bind group 1: albedo + normal + ORM + emissive (8 bindings) - pbr_shader.wgsl: ORM sampling (R=AO, G=roughness, B=metallic) + emissive - deferred_gbuffer.wgsl: ORM + emissive luminance in material_data.w - deferred_lighting.wgsl: emissive contribution from G-Buffer - All 5 PBR examples updated with default ORM/emissive textures - Backward compatible: old 4-binding layout preserved Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ use voltex_renderer::{
|
||||
gbuffer_camera_bind_group_layout,
|
||||
lighting_gbuffer_bind_group_layout, lighting_lights_bind_group_layout,
|
||||
lighting_shadow_bind_group_layout,
|
||||
pbr_texture_bind_group_layout, create_pbr_texture_bind_group,
|
||||
pbr_full_texture_bind_group_layout, create_pbr_full_texture_bind_group,
|
||||
SsgiResources, SsgiUniform,
|
||||
ssgi_gbuffer_bind_group_layout, ssgi_data_bind_group_layout, create_ssgi_pipeline,
|
||||
RtAccel, RtInstance, BlasMeshData, RtShadowResources, RtShadowUniform,
|
||||
@@ -119,6 +119,8 @@ struct AppState {
|
||||
// Keep textures alive
|
||||
_albedo_tex: GpuTexture,
|
||||
_normal_tex: (wgpu::Texture, wgpu::TextureView, wgpu::Sampler),
|
||||
_orm_tex: GpuTexture,
|
||||
_emissive_tex: GpuTexture,
|
||||
_shadow_map: ShadowMap,
|
||||
_ibl: IblResources,
|
||||
_shadow_uniform_buffer: wgpu::Buffer,
|
||||
@@ -171,7 +173,7 @@ impl ApplicationHandler for DeferredDemoApp {
|
||||
// G-Buffer pass bind group layouts
|
||||
// ---------------------------------------------------------------
|
||||
let gbuf_cam_layout = gbuffer_camera_bind_group_layout(&gpu.device);
|
||||
let pbr_tex_layout = pbr_texture_bind_group_layout(&gpu.device);
|
||||
let pbr_tex_layout = pbr_full_texture_bind_group_layout(&gpu.device);
|
||||
let mat_layout = MaterialUniform::bind_group_layout(&gpu.device);
|
||||
|
||||
// Camera dynamic uniform buffer (one CameraUniform per sphere)
|
||||
@@ -204,17 +206,23 @@ impl ApplicationHandler for DeferredDemoApp {
|
||||
}],
|
||||
});
|
||||
|
||||
// PBR textures: white albedo + flat normal
|
||||
// PBR textures: white albedo + flat normal + ORM + emissive
|
||||
let old_tex_layout = GpuTexture::bind_group_layout(&gpu.device);
|
||||
let albedo_tex = GpuTexture::white_1x1(&gpu.device, &gpu.queue, &old_tex_layout);
|
||||
let normal_tex = GpuTexture::flat_normal_1x1(&gpu.device, &gpu.queue);
|
||||
let pbr_texture_bind_group = create_pbr_texture_bind_group(
|
||||
let orm_tex = GpuTexture::white_1x1(&gpu.device, &gpu.queue, &old_tex_layout);
|
||||
let emissive_tex = GpuTexture::black_1x1(&gpu.device, &gpu.queue, &old_tex_layout);
|
||||
let pbr_texture_bind_group = create_pbr_full_texture_bind_group(
|
||||
&gpu.device,
|
||||
&pbr_tex_layout,
|
||||
&albedo_tex.view,
|
||||
&albedo_tex.sampler,
|
||||
&normal_tex.1,
|
||||
&normal_tex.2,
|
||||
&orm_tex.view,
|
||||
&orm_tex.sampler,
|
||||
&emissive_tex.view,
|
||||
&emissive_tex.sampler,
|
||||
);
|
||||
|
||||
// Material bind group (dynamic offset, group 2)
|
||||
@@ -581,6 +589,8 @@ impl ApplicationHandler for DeferredDemoApp {
|
||||
shadow_layout,
|
||||
_albedo_tex: albedo_tex,
|
||||
_normal_tex: normal_tex,
|
||||
_orm_tex: orm_tex,
|
||||
_emissive_tex: emissive_tex,
|
||||
_shadow_map: shadow_map,
|
||||
_ibl: ibl,
|
||||
_shadow_uniform_buffer: shadow_uniform_buffer,
|
||||
|
||||
Reference in New Issue
Block a user