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:
@@ -11,7 +11,7 @@ use voltex_renderer::{
|
||||
GpuContext, Camera, FpsController, CameraUniform, LightsUniform, LightData,
|
||||
Mesh, GpuTexture, MaterialUniform, generate_sphere, create_pbr_pipeline, obj,
|
||||
ShadowMap, ShadowUniform,
|
||||
IblResources, pbr_texture_bind_group_layout, create_pbr_texture_bind_group,
|
||||
IblResources, pbr_full_texture_bind_group_layout, create_pbr_full_texture_bind_group,
|
||||
};
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
@@ -35,6 +35,8 @@ struct AppState {
|
||||
camera_light_bind_group: wgpu::BindGroup,
|
||||
_albedo_tex: GpuTexture,
|
||||
_normal_tex: (wgpu::Texture, wgpu::TextureView, wgpu::Sampler),
|
||||
_orm_tex: GpuTexture,
|
||||
_emissive_tex: GpuTexture,
|
||||
pbr_texture_bind_group: wgpu::BindGroup,
|
||||
material_bind_group: wgpu::BindGroup,
|
||||
shadow_bind_group: wgpu::BindGroup,
|
||||
@@ -149,7 +151,7 @@ impl ApplicationHandler for MultiLightApp {
|
||||
|
||||
// Bind group layouts
|
||||
let cl_layout = camera_light_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+Light bind group
|
||||
@@ -174,17 +176,23 @@ impl ApplicationHandler for MultiLightApp {
|
||||
],
|
||||
});
|
||||
|
||||
// PBR texture bind group (albedo + normal)
|
||||
// PBR texture bind group (albedo + 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,
|
||||
);
|
||||
|
||||
// IBL resources
|
||||
@@ -252,6 +260,8 @@ impl ApplicationHandler for MultiLightApp {
|
||||
camera_light_bind_group,
|
||||
_albedo_tex: albedo_tex,
|
||||
_normal_tex: normal_tex,
|
||||
_orm_tex: orm_tex,
|
||||
_emissive_tex: emissive_tex,
|
||||
pbr_texture_bind_group,
|
||||
material_bind_group,
|
||||
shadow_bind_group,
|
||||
|
||||
Reference in New Issue
Block a user