Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated UV2s are not saved #32746

Closed
lawnjelly opened this issue Oct 11, 2019 · 11 comments
Closed

Generated UV2s are not saved #32746

lawnjelly opened this issue Oct 11, 2019 · 11 comments

Comments

@lawnjelly
Copy link
Member

Godot version:
Latest 3.2 Alpha aad4d86

OS/device including version:
Linux Mint 18.2

Issue description:
When you use the menu option Mesh->Unwrap UV2 for Lightmap/AO this successfully generates second set of UVs which can be viewed with Mesh->View UV2 and can be used for lightmapping.

The problem is that this is not registered as a change to the scene (the * does not appear on the scene tab) and it is not autosaved, as Godot thinks there have been no changes. Then next time you load the project, the lightmapping is gone, because the UV2 coords are not saved.

It took me a while to figure out what was going wrong here. When I was using a mesh stored in a tscn file, I could force it to save by explicitly choosing Scene->Save Scene from the menu. With an obj file I can't seem to get it to save UV2 at all.

Steps to reproduce:
Add a MeshInstance mesh that has no second set of UVs. Choose 'Unwrap UV2', verify they are there with 'View UV2'. Press Ctrl-S to save, then quit godot, and reopen the project. The UV2s are gone.

Minimal reproduction project:
UV2Bug.zip

@Brandt-J
Copy link

Brandt-J commented Apr 8, 2020

I have the same issue, also with .obj models. Did it work in other versions of Godot? This bug makes the generate-lightmap-uv function essential useless :(

@wombatwingdings
Copy link

wombatwingdings commented Jun 9, 2020

Same problem here in Godot 3.2.2 Beta #39134 (from 8 June 2020). Not using .OBJ files.

OS/device including version:
Windows 10

UV2 seem to be stored in memory only. They don't appear to be stored in the scene, which is why the tscn file is not marked as modified (no "*" appearing on title).

Generating UV2 and reloading tscn; UV2 are there (save or no save). Restart Gogot; UV2 are gone.

Maybe this is by design? The baking will still work but the user needs to remember to generate UV2s before every bake.

@huhund
Copy link

huhund commented Sep 30, 2020

Doh, I stumble on the same issue, thanks for writing this bug report. I noticed that something else also gets broken after generating UV2. Because the material is not loaded after generating UV2 and saving. Unfortunately this makes it impossible to use this feature currently.

I wonder if this will change with Godot 4.0. As rumours tells me it will get a new light mapper.

Does anybody use authored UV2s? Is that working better?

@Calinou
Copy link
Member

Calinou commented Sep 30, 2020

This should already fixed in the master branch now. Also, #40035 will fix this in 3.2.x if it's merged into the 3.2 branch.

The current lightmapper in 3.2.3 is pretty broken, I wouldn't rely on it in general.

@lawnjelly
Copy link
Member Author

You can author UV2s in blender / other modelling packages. But you can't import them as obj, as it only supports 1 uv channel, you will have to use another format (e.g. dae). This can work if you are e.g. building a level in blender. But if you are constructing the level out of objects within godot, it might not work well.

You can also do uv mapping with LLightmap if you are prepared to use a module, depending on what you are trying to do:
https://github.com/lawnjelly/godot-llightmap

@autofool
Copy link

So, should we wait for the new light-mapper? Or the new light mapper is 4.0 exclusive? What's the direction here? Is using authored UV2, final solution?

@lawnjelly
Copy link
Member Author

At present you can write code (in c++ or gdscript etc) to manually copy the vertices, uvs etc to a new mesh, and save that. That's the approach I ended up using, I don't know if there is any easier way (perhaps some duplicate mesh command or something).

@autofool
Copy link

autofool commented Apr 17, 2021

Well, it's better to use 'gltf' then. I like to create nodes with obj cause they give me more control over hierarchy. Currently with gltf I have to create hierarchy PLUS copy the parameters for 'meshinstance' or other nodes. In any case, the bug is not major issue if other formats are working.

@akien-mga akien-mga added this to the 3.3 milestone Apr 28, 2021
@akien-mga
Copy link
Member

Fixed by #44628.

@Favkis
Copy link

Favkis commented Aug 26, 2022

godot 3.5 bug is not fixed, I cannot bake gridmap because UV2 arent saved at all.

@Calinou
Copy link
Member

Calinou commented Aug 26, 2022

godot 3.5 bug is not fixed, I cannot bake gridmap because UV2 arent saved at all.

If you're using OBJ meshes as tiles, see #52508. You need to import the OBJ meshes as scenes for it to work, or use glTF (or Collada) instead.

Edit: @Favkis opened #64914, which turned out to be a configuration error. So this is indeed resolved in Godot 3.3 and later 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants