Remove calculate_diffuse_color
and calculate_F0
from pbr_functions
because they're now duplicated in pbr_lighting
This commit is contained in:
parent
1111a6aa5a
commit
c92073b298
@ -4,6 +4,7 @@
|
|||||||
pbr_types::{PbrInput, pbr_input_new, STANDARD_MATERIAL_FLAGS_UNLIT_BIT},
|
pbr_types::{PbrInput, pbr_input_new, STANDARD_MATERIAL_FLAGS_UNLIT_BIT},
|
||||||
pbr_deferred_types as deferred_types,
|
pbr_deferred_types as deferred_types,
|
||||||
pbr_functions,
|
pbr_functions,
|
||||||
|
lighting,
|
||||||
rgb9e5,
|
rgb9e5,
|
||||||
mesh_view_bindings::view,
|
mesh_view_bindings::view,
|
||||||
utils::{octahedral_encode, octahedral_decode},
|
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 metallic = in.material.metallic;
|
||||||
let specular_transmission = in.material.specular_transmission;
|
let specular_transmission = in.material.specular_transmission;
|
||||||
let diffuse_transmission = in.material.diffuse_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,
|
base_color,
|
||||||
metallic,
|
metallic,
|
||||||
specular_transmission,
|
specular_transmission,
|
||||||
|
@ -260,23 +260,6 @@ fn calculate_view(
|
|||||||
return V;
|
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
|
#ifndef PREPASS_FRAGMENT
|
||||||
fn apply_pbr_lighting(
|
fn apply_pbr_lighting(
|
||||||
in: pbr_types::PbrInput,
|
in: pbr_types::PbrInput,
|
||||||
|
Loading…
Reference in New Issue
Block a user