Skip to content

Commit 4b78ba0

Browse files
author
Dragoș Tiselice
authored
Replaced implicit emissive weight with default. (#13871)
Since `StandardMaterial::emissive_exposure_weight` does not get packed into the gbuffer in the deferred case, unpacking uses an implicit default value for emissive's alpha channel. This resulted in divergent behavior between the forward and deferred renderers when using standard materials with default emissive_exposure_weight, this value defaulting to `0.0` in the forward case and `1.0` in the other. This patch changes the implicit value in the deferred case to `0.0` in order to match the behavior of the forward renderer. However, this still does not solve the case where `emissive_exposure_weight` is not `0.0`.
1 parent ba3d9b3 commit 4b78ba0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/bevy_pbr/src/deferred/pbr_deferred_functions.wgsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ fn pbr_input_from_deferred_gbuffer(frag_coord: vec4<f32>, gbuffer: vec4<u32>) ->
7676
let emissive = rgb9e5::rgb9e5_to_vec3_(gbuffer.g);
7777
if ((pbr.material.flags & STANDARD_MATERIAL_FLAGS_UNLIT_BIT) != 0u) {
7878
pbr.material.base_color = vec4(emissive, 1.0);
79-
pbr.material.emissive = vec4(vec3(0.0), 1.0);
79+
pbr.material.emissive = vec4(vec3(0.0), 0.0);
8080
} else {
8181
pbr.material.base_color = vec4(pow(base_rough.rgb, vec3(2.2)), 1.0);
82-
pbr.material.emissive = vec4(emissive, 1.0);
82+
pbr.material.emissive = vec4(emissive, 0.0);
8383
}
8484
#ifdef WEBGL2 // More crunched for webgl so we can also fit depth.
8585
let props = deferred_types::unpack_unorm3x4_plus_unorm_20_(gbuffer.b);

0 commit comments

Comments
 (0)