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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user