Diagnosing Incorrect UV Wrapping

Hi All, I’m trying to render an FBX model that has a texture, but my texture doesn’t seem to be mapping to the model properly:

I tried some different blending and texture wrapping options, but haven’t figured out how to get the windows to display properly yet. If anyone has any ideas on how to diagnose and resolve this kind of issue, I’d be grateful for their input!

When debugging texture coordinates in general, I find it helpful to visualize the uv data with a special debugging texture. Stuff like wrong uv data or discontinuities can easily be discovered at one glance.

Demo: https://jsfiddle.net/swjm3nt4/1/

1 Like

You have some yellow triangle dublicates slightly in front of the windows, you see it when moving the camera on it.


Also notice some flipped dublicates inside of the taxi.


This is clever! I have a quick follow up–I wrapped my little car with this uv texture, but I can’t quite tell what coordinates are being plotted as the upper triangle on the windshield:

Is there a clever way to figure that out? I feel like GPU picking is the right way to solve this, but that’s a bit of work to set up. If there’s something simple it’d be great to read about it!

Interesting, what is a dublicate @Fyrestar?

There are simply triangles covering your actual windows. The dublicates inside are basically the exact triangles 2 times at the same spot, while the second is flipped so it is only visible when viewed backside.

1 Like

Aha! Did you use something like Blender to investigate the vertices? Or just scour for duplicate vertices in three.js?

I’ve just moved the camera inside the taxi to inspect, in your codepen :cat:

But i would use the modelling tool like Blender or C4D yes.

1 Like

@Fyrestar just so I understand, if I climb inside the mesh and can see rendered textures in there (like below, which is looking at the back left of the car), does that mean that I have duplicated vertices and a texture that’s facing into the center of the car?

Yes, by default backface culling is enabled that means triangles are rendered only from the front, it’s defined by the order of the face indices being clockwise. If backface culling isn’t enabled in the tool that doesn’t mean there will be dublicated triangles, they just render both sides but for some reason in your model they are dublicated. If you see a hole from the outside, but the triangle from the inside, it is just 1 triangle being flipped.

If it doesn’t appear wrong in your modelling tool you’d need to investigate from the tool, there might be procedural operations which aren’t backed into the geometry and backed wrong on export, but it’s just a wild guess. Anyway you can just delete the unwanted faces in Blender.

1 Like