Skip to content

three-gpu-pathtracer hardcodes first UV Map for materials, even if that's the wrong one #696

@FrostKiwi

Description

@FrostKiwi

Describe the bug
As noticed in mrdoob/three.js#32067 (comment), three-gpu-pathtracer seems to hardcode the UV map that it uses to UV Map zero. For scenes with baked AO, three-gpu-pathtracer ignores baked AO, as it should and only uses the other texture channels during its Material setup.

Geometry may come with multiple UV Maps, as for Baked AO other Mapping strategies are needed. Whilst it's convention to keep the UV Maps for the base material as UVMap 0 and UV Maps for AO as UVMap 1, it may be the other way around. ThreeJS has no issues handling this and no matter what UV Map is used for which texture, it handles it fine. three-gpu-pathtracer on the other hand has issues here and seems to hardcode that it always uses UV Map0 of its textures, even if the texture setup requires UV Map 1.

This breaks materials for assets with UV map 1 for its textures. Setting it the other way around, fixes the issue, as shown in the screenshots below.

Expected behavior

Like ThreeJS, pick the correct UV map, instead of assuming UV map 0 for materials.

Screenshots and Repro Model

ThreeJS v0.180.0 (UV for AO in Channel 0, UV for Base Materials in Channel 1) three-gpu-pathtracer (UV for AO in Channel 0, UV for Base Materials in Channel 1) three-gpu-pathtracer (UV for Base Materials in Channel 0, UV for AO in Channel 1)
Image Image Image
Image

Platform:

  • Device: [all]
  • OS: [all]
  • GPU: [all]
  • Browser: [all]
  • Browser Version: [all]
  • Three.js version: [v0.180.0]
  • Library version: [v0.0.23]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions