Remove calculate_diffuse_color and calculate_F0 from pbr_functions because they're now duplicated in pbr_lighting

This commit is contained in:
William Rose 2025-03-22 11:49:09 +00:00
parent 1111a6aa5a
commit c92073b298
2 changed files with 2 additions and 18 deletions

View File

@ -4,6 +4,7 @@
pbr_types::{PbrInput, pbr_input_new, STANDARD_MATERIAL_FLAGS_UNLIT_BIT},
pbr_deferred_types as deferred_types,
pbr_functions,
lighting,
rgb9e5,
mesh_view_bindings::view,
utils::{octahedral_encode, octahedral_decode},
@ -64,7 +65,7 @@ fn deferred_gbuffer_from_pbr_input(in: PbrInput) -> vec4<u32> {
let metallic = in.material.metallic;
let specular_transmission = in.material.specular_transmission;
let diffuse_transmission = in.material.diffuse_transmission;
let diffuse_color = pbr_functions::calculate_diffuse_color(
let diffuse_color = lighting::calculate_diffuse_color(
base_color,
metallic,
specular_transmission,

View File

@ -260,23 +260,6 @@ fn calculate_view(
return V;
}
// Diffuse strength is inversely related to metallicity, specular and diffuse transmission
fn calculate_diffuse_color(
base_color: vec3<f32>,
metallic: f32,
specular_transmission: f32,
diffuse_transmission: f32
) -> vec3<f32> {
return base_color * (1.0 - metallic) * (1.0 - specular_transmission) *
(1.0 - diffuse_transmission);
}
// Remapping [0,1] reflectance to F0
// See https://google.github.io/filament/Filament.html#materialsystem/parameterization/remapping
fn calculate_F0(base_color: vec3<f32>, metallic: f32, reflectance: vec3<f32>) -> vec3<f32> {
return 0.16 * reflectance * reflectance * (1.0 - metallic) + base_color * metallic;
}
#ifndef PREPASS_FRAGMENT
fn apply_pbr_lighting(
in: pbr_types::PbrInput,