Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering artifacts on flat surfaces #12109

Closed
javagl opened this issue Aug 6, 2024 · 3 comments · Fixed by #12116
Closed

Rendering artifacts on flat surfaces #12109

javagl opened this issue Aug 6, 2024 · 3 comments · Fixed by #12116

Comments

@javagl
Copy link
Contributor

javagl commented Aug 6, 2024

What happened?

There are some strange rendering artifacts that appear on flat surfaces. They look like "screen-space" lines that depend on the view direction.

Reproduction steps

Start the first sandcastle from https://community.cesium.com/t/debug-lines-in-cesium-120/34306 , and rotate the view.

The comment at https://community.cesium.com/t/debug-lines-in-cesium-120/34306/4 summarizes the issue and the commit where it likely has been introduced.

Sandcastle example

See the linked forum thread

Environment

Browser: All
CesiumJS Version: Problem appears in 1.120. It does not appear in 1.119
Operating System: All

@jjhembd
Copy link
Contributor

jjhembd commented Aug 7, 2024

@javagl or @bertt, can you provide a Sandcastle for testing?
I see a possibly related problem on glTF models, but I can't be sure that the problem on this tileset is the same.

In the glTF PBR Extensions Sandcastle, if I set "Direct lighting only" and look at the "Water Bottle" model from the side opposite the light direction, I see some artifacts that appear to be reflections from the wrong side of the surface:
image

These go away if I change these lines in pbrLighting.glsl:

float computeDirectSpecularStrength(vec3 normal, vec3 lightDirection, vec3 viewDirection, vec3 halfwayDirection, float alphaRoughness)
{
    float NdotL = dot(normal, lightDirection);
    float NdotV = abs(dot(normal, viewDirection));
    // ...

to clamp (NOT abs) both NdotL and NdotV to the range [0.0, 1.0]. The rendering then becomes:

image

@javagl
Copy link
Contributor Author

javagl commented Aug 8, 2024

The link to the PBR extensions sandcastle is https://sandcastle.cesium.com/index.html?src=glTF%20PBR%20Extensions.html

They can be found in the Sandcastle/Demo that @bertt linked to in the forum thread. But since they depend on the exact view direction and the time of the day (!), here is everything frozen in a standalone sandcastle:

https://sandcastle.cesium.com/index.html#c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R+SmackLx94LvQdC3HCDRghzB0vNB3NWAZHeW7jB+WowyB0wfp/RmJlFfdMSw3AW7OK8Rx3C6tOodAZXNLL5LIOIbyK1PXQZU6uVGCsrKkd+ut9gZ127Rcx7csaAeBaXp2YPiyg3F82zbMAFquEdjy3dKAY/i2E3gwdE3bDCXXrTKecSrbrJcuPhEcUza7oiKaX2dJ0jZg4AVe6NqeGdheEAahdGRA1/VMmRzT9g3fCn1HAx60AtsMXCvw5WCF4fOePcUbJVl0B6OCc9Xg0ZRsNu9zkcioTuXul9vRz7PAM0z5T2EZlnNgBAeGPzL8rml0DePXcav6g2hpraNcPCbkeH2ef6SyfeRCtkdJG0JdkHSRyDVzfVJEd0TAKM87h5XykV43PYrpEtD4Q8NPDIgS2ftJybRIkhv6Jxm3jo90qf/CNMnK1A1lY5fgR6U2N48HFRNCeKRLstlSZFkywXxn5b8B

For the Water Bottle, there's a bit of noise, but that's probably some roughness from the texture. The glTF in the sandcastle above just has a plain metallic-roughness, so the artifacts look like sharp lines. But from the overall appearance and the "behavior" of the artifacts when zooming/moving, I'd say that the reason is very likely the same in both cases.

@javagl
Copy link
Contributor Author

javagl commented Aug 8, 2024

An aside: I'm sure that this is not a coincidence:

Cesium Lines

but didn't do the math to explain it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants