Urho3D-Blender icon indicating copy to clipboard operation
Urho3D-Blender copied to clipboard

Suggestion for handling UV2

Open Enhex opened this issue 9 years ago • 5 comments

Instead of requiring a texture that points to the UV2 map for each mesh, why not directly look for the UV2 map?

Enhex avatar Jul 11 '15 08:07 Enhex

Hello Enhex, because it is helpful when you export more than one object, you can decide which of them need a UV2 map and you can have a different UV2 map for each of them.

reattiva avatar Jul 17 '15 12:07 reattiva

You can still achieve that with directly looking for the UV map since it's per mesh, right?

Enhex avatar Jul 23 '15 11:07 Enhex

I think UV maps and objects are independents entities and textures link them together. Here is where the map is loaded: https://github.com/reattiva/Urho3D-Blender/blob/master/io_mesh_urho/decompose.py#L1489 if you have a different approach, can you share some code?

reattiva avatar Jul 25 '15 00:07 reattiva

UV maps are part of a mesh and the texture slots are part of a material. Both aren't directly part of an object. I'm not sure if there's a specific requirement, but if UV2 is only relevant to the mesh then you only need to check if there's a UV map for it in the mesh.

Code-wise it should be just iterating over the meshes and checking if they have "_UV2" map. Similar to what you have now.

For example I plan to use UV2 for lightmaps, and since I don't want to write every possible combination of diffuse & lightmap material manually, I want to generate them on the fly. That means that UV2 doesn't have to be bound to a texture/material when exporting geometry. It only adds extra redundant work.

Enhex avatar Jul 27 '15 11:07 Enhex

I need the code to find the UV map from the mesh. Anyway, I prefer to leave it as it is, UV map are "mainly" made to work with a texture so it makes sense to have one, it can always be an empty placeholder texture.

reattiva avatar Jul 27 '15 16:07 reattiva