Properly apply emissive to masked materials (#7122)

* Properly apply emissive to masked materials

The emissive property should not be multiplied by the color alpha
in masked materials. The alpha is treated as a coverage value in
that case, not an opacity value.

* Update release notes
This commit is contained in:
Romain Guy
2023-08-30 08:43:36 -07:00
committed by GitHub
parent 0aa0efe159
commit ef07638eef
3 changed files with 10 additions and 2 deletions
+2
View File
@@ -9,3 +9,5 @@ appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
## Release notes for next branch cut
- `setFrameCompletedCallback` now takes a `backend::CallbackHandler`.
- The `emissive` property was not applied properly to `MASKED` materials, and could cause
dark fringes to appear
+4 -1
View File
@@ -299,7 +299,10 @@ void addEmissive(const MaterialInputs material, inout vec4 color) {
#if defined(MATERIAL_HAS_EMISSIVE)
highp vec4 emissive = material.emissive;
highp float attenuation = mix(1.0, getExposure(), emissive.w);
color.rgb += emissive.rgb * (attenuation * color.a);
#if defined(BLEND_MODE_TRANSPARENT) || defined(BLEND_MODE_FADE)
attenuation *= color.a;
#endif
color.rgb += emissive.rgb * attenuation;
#endif
}
+4 -1
View File
@@ -2,7 +2,10 @@ void addEmissive(const MaterialInputs material, inout vec4 color) {
#if defined(MATERIAL_HAS_EMISSIVE)
highp vec4 emissive = material.emissive;
highp float attenuation = mix(1.0, getExposure(), emissive.w);
color.rgb += emissive.rgb * (attenuation * color.a);
#if defined(BLEND_MODE_TRANSPARENT) || defined(BLEND_MODE_FADE)
attenuation *= color.a;
#endif
color.rgb += emissive.rgb * attenuation;
#endif
}