Texture coordinates are jumbled in path tracer but appear correctly in regular renderer.
Describe the bug
I have a scene with a terrain that has a mapbox texture applied and some objects with the standard material and some simple textures applied. I'm finding that the texture samples become jumbled when path tracing is enabled.
Expected behavior
I'm expecting texture samples to be in the correct place.
Screenshots and Repro Model
I don't have a gltf model because this is created dynamically (although can implement an exporter if that would help)
Here's a screenshot with standard GPU rendering:
And here's one with the path tracer enabled:
The texture is applied, but the texture samples are completely jumbled
This is unfortunately code for work so I can't share it directly, but if it helps I can try to export either a glTF of my current scene, or maybe a smaller repro (hard to do though, a lot of data is from dynamic apis. The scene itself is very simple though, no fancy stuff going on (just standard materials))
Platform:
- Device: ThinkPad P16 Gen 2
- OS: Windows 11
- GPU: NVidia RTX A1000 6GB Laptop GPU (and Intel UHD Graphics but my browser should be configured in NVidia settings to use the NVidia GPU)
- Browser: Chrome
- Browser Version: Version 142.0.7444.176 (Official Build) (64-bit)
- Three.js version: 0.179.0
- Library version: 0.0.23
Hi @IanOvergardADSK - without a repro of any kind it's hard to say what exactly might be going on. Though bear in mind that if you're using multiple UV coordinates you may run into some issues. See #696.
If that doesn't look like the issue then a small repro using an exported GLTF file would be appreciated.
Hi!
Here's a GLB of the scene (I tried to export it as directly as I could, excluding things that can't be exported to gltf (lines)). Sorry it's probably a little clunky to work with, the scene is z-up so it loads sideways. This was with the ThreeJS gltf exporter. I can load this file in Blender and the texture coordinates look correctly (specifically the terrain and the very weird boat like building). I don't believe I'm using multiple UV coordinates, at least not on purpose. Thanks!
The model specifies "vertexColors" without actually having vertex color attributes so I had do disable that material flag but the texture otherwise looks okay once disabling that. There must be something else causing the issue in the app or GLTFLoader is adjusting the data on export such that it removes the problematic settings. It's been awhile since I've worked on this project so I don't recall what may specifically be causing UVs to map incorrectly in this way, unfortunately. There have been some reports of incorrect material mapping but that doesn't seem relevant here.
Interesting that it's working for you! I think my next step will be to export to gltf than reload in the same app and see if the GLTF loader is doing something different. Is it at all possible something like camera settings or something unrelated to the geometry buffer could cause this?
Also, interesting sidenote is it seems like the roofs of the buildings have incorrect normals? Unless I'm just reading the lighting incorrectly.
Is it at all possible something like camera settings or something unrelated to the geometry buffer could cause this?
Not that I recall. The path tracer generates a static version of the scene by merging all geometries for rendering. I check the following:
- Check to make sure there is only 1 uv channel in use.
- Ensure UVs are not outside of the [0, 1] range. The path tracing does not support things like texture repeat wrapping.
- Rendering just the terrain itself and see how that looks.
Also, interesting sidenote is it seems like the roofs of the buildings have incorrect normals? Unless I'm just reading the lighting incorrectly.
It looks fine to me. The buildings have a high metalness values, resulting in ambient reflections from the terrain on the sides of the buildings and the environment map used has hash lighting from the side, as you can see from the shadows, so the top of the buildings may look darker.