Skip to content

Refraction attenuation renders wrong #8048

@animech-sijo

Description

@animech-sijo

PlayCanvas' implementation of refraction doesn't behave correctly. When using attenuation, the entire object gets a bright, milky white look. This doesn't behave as users expect, or how refraction works in the real world, and it doesn't match how glTF renderers renders refraction. Compare these images:

glTF Sample Viewer PlayCanvas
Image Image

Notice especially the 0.25 and 0.5 columns, where the objects are much brighter than expected. It feels like the shader is wrong, and not energy conserving.

In fact, even just enabling attenuation with a white color (meaning no absorbtion), it immediately becomes milky. It doesn't matter what attenuation distance you set, as long as it's above 0.

Attenuation distance 0 Attenuation distance > 0
Image Image

We need this fixed to be able to create accurate glass materials that render correctly.

Test project: https://playcanvas.com/project/1405372/overview/attenuation
glTF sample model & viewer: https://github.khronos.org/glTF-Assets/model/AttenuationTest
Renderer comparisons: https://github.khronos.org/glTF-Render-Fidelity/model/AttenuationTest

Metadata

Metadata

Assignees

Labels

area: graphicsGraphics related issuebugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions