Shaders: Perturbed Normals + Bad UV's, Issues

Hi there!

I’m curious how to deal with a certain situation. On our platform users can upload their own content which could have fantastic UV’s but sometimes not so great UV’s

We’ve noticed a visual artifact when the model they upload has really bad UV’s (All on the same point, as one example). Combined with using a PBR shader with the Perturbed Normal node.

Visual artifacts are usually the model is pure black on some browsers or full of visual snow (some pixels are correct while others show up as black).

We don’t like the complexity of multiple shaders and branching code to support edge cases but maybe we’re missing something simple to resolve this.

I’ve made a playground of the issue:

Thank you.

( Updated Link thanks to UNIT below )

If you hover your mouse over sphereBadUVs, you will see that the mesh is not included as shown in the picture below.

image

so, assign the mesh to the variable and assign the imported material to the variable to confirm that it works normally.

https://playground.babylonjs.com/#TMSM7K#2https://playground.babylonjs.com/#TMSM7K#2

I hope this is what you want :grinning:

1 Like

Thank you very much UNIT. I’ve adjusted my post with your fixed project.

Hopefully that makes things clearer for others about the UV with perturbed normal issue I’m facing.

1 Like

I’ve researched the issue, and the best thing you can do is to put a similar color on it unless the user fixes the mesh UV and upload it again.
It’s hard to expect textured images to work normally.
If it’s monochrome, it’s going to look similar.
But if that’s not the case, I think reuploading is the best way
(I’m not sure, but I asked my 3Dmodeler co-worker)

1 Like

Thank you again for taking a look UNIT. In my example shader I’m using the default normal map colour so the colour shouldn’t be causing issues.

The thing that gives me hope is I don’t see this issue on any other platform. Using the PBR shader in Unity, UE5 and other engines I don’t see the issues I’ve mentioned.

I’d like our users to live in a beautiful world where they don’t have to worry about UVs if they don’t want to. :smile:

UVs are used to infer a tangent space related to the texture mapping as long as tangents are not provided.

Unfortunately the space can not be inferred without correct data for the mesh.

I am not sure there are any easy way to solve this without a long processing process. @bghgary ?

Hey there just checking in, was your question answered? @PeterJig

Hi @carolhmj

No this is still an issue.
Users of our platform can upload models and we have no control over if they have clean UV’s. This means they are seeing objects that are rendered black or with black artefacts over their objects. Has there been any developments towards resolving this issue?

I think Uv projection by waverider404 · Pull Request #12535 · BabylonJS/Babylon.js · GitHub would have been helpful to you.

Maybe you can take the code and integrate it into your project?

2 Likes