KhronosGroup / KhronosGroup/UnityGLTF

"Generate Lightmap UVs" does not expose options and does not override existing UV2

Open
#871 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.2k
Forks
536
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug 💬

Follow-up to #668. Unity's ModelImporter replaces UV2 when "Generate Lightmap UVs" is selected in the importer, UnityGLTF currently just uses the underlying `Unwrapping.GenerateSecondaryUVSet()` method, which seems to simply do nothing when there's existing UVs, so we probably need to delete the existing UVs first.

Additionally, it's probably a good idea to expose the parameters that go into that method, same as the FBX importer.

### Steps to reproduce 🔢

1. Import file that has UV2
2. Enable "Generate Lightmap UVs"
3. Note no new UVs are generated, in contrast to Unity's model importer

### Files to reproduce the issue ♻

See #668

### Editor Version 🎲

2021.3

### Render Pipeline and version

All

### UnityGLTF Version

2.17.1

### Operating System 👩‍💻

Windows, macOS, Linux

### When does this problem happen?

- [x] Editor Import
- [ ] Runtime Import
- [ ] Editor Export
- [ ] Runtime Export

### Additional Info 📜

_No response_

### Validations 🩹

- [x] I have [searched existing issues](https://github.com/KhronosGroup/UnityGLTF/issues): no issue already exist that reports the same problem.
- [x] I follow the [Code of Conduct](https://www.khronos.org/about/code-of-conduct)
- [x] I provided a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example), including files when necessary.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the editor-import path that calls Unity's Unwrapping.GenerateSecondaryUVSet() and compare its available parameters with the Unity FBX importer. Reproduce the case from #668 with an existing UV2, then verify that generated lightmap UVs replace it and that the relevant generation options are exposed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
computer-graphics, game-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.