Switch the constant in bevy-pbr to avoid display incosistencies

This commit is contained in:
Dzmitry Malyshau 2021-10-23 23:31:30 -04:00 committed by Dzmitry Malyshau
parent a03f23c132
commit fd5085277a
2 changed files with 4 additions and 4 deletions

View File

@ -115,7 +115,7 @@ float getDistanceAttenuation(float distanceSquare, float inverseRangeSquared) {
float factor = distanceSquare * inverseRangeSquared;
float smoothFactor = saturate(1.0 - factor * factor);
float attenuation = smoothFactor * smoothFactor;
return attenuation * 1.0 / max(distanceSquare, 1e-4);
return attenuation * 1.0 / max(distanceSquare, 1e-3);
}
// Normal distribution function (specular D)
@ -353,7 +353,7 @@ void main() {
emissive.rgb *= texture(sampler2D(StandardMaterial_emissive_texture, StandardMaterial_emissive_texture_sampler), v_Uv).rgb;
vec3 V = normalize(CameraPos.xyz - v_WorldPosition.xyz);
// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"
float NdotV = max(dot(N, V), 1e-4);
float NdotV = max(dot(N, V), 1e-3);
// Remapping [0,1] reflectance to F0
// See https://google.github.io/filament/Filament.html#materialsystem/parameterization/remapping

View File

@ -135,7 +135,7 @@ fn getDistanceAttenuation(distanceSquare: f32, inverseRangeSquared: f32) -> f32
attenuation = (e64 * e65);
let e68: f32 = attenuation;
let e73: f32 = distanceSquare1;
return ((e68 * 1.0) / max(e73, 0.00009999999747378752));
return ((e68 * 1.0) / max(e73, 0.0010000000474974513));
}
fn D_GGX(roughness: f32, NoH: f32, h: vec3<f32>) -> f32 {
@ -791,7 +791,7 @@ fn main1() {
let e175: vec3<f32> = V3;
let e180: vec3<f32> = N2;
let e181: vec3<f32> = V3;
NdotV4 = max(dot(e180, e181), 0.00009999999747378752);
NdotV4 = max(dot(e180, e181), 0.0010000000474974513);
let e187: f32 = global6.reflectance;
let e189: f32 = global6.reflectance;
let e192: f32 = metallic;