Lightmap UVs

Is there any way to get secondary UV coordinates that are used for lightmapping?

@AkzhigitovAnton

Yes, it is supported by multiple VertexElementUV in Mesh class, as long as the file type support multiple UV like FBX.

@asad.ali
Method GetVertexElementOfUV returns VertexElementUV instance only for Diffuse mapping type. Am I doing something wrong? Or should I use another method?

@AkzhigitovAnton

Yes, you can use CreateVertexElementUV to create a new VertexElementUV other than TextureMapping.Diffuse. But no light map there, you should use a different TextureMapping to act as light map.

Only a few formats support multiple UV.

@asad.ali
I already have fbx model with lightmap texture coordinates. And I have checked all texture mapping types for this model. For some reason there are no secondary uvs specified with aspose. In any type of mapping. I checked all 12 TextureMapping enum values.

@AkzhigitovAnton

Could you please share your sample file in .zip format along with complete sample code snippet that you have tried so far? We will test the scenario in our environment and address it accordingly.

@asad.ali
uvs.zip (10.7 KB)

@AkzhigitovAnton

We have logged an investigation ticket as THREEDNET-875 in our issue tracking system for your case. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

@asad.ali
Hello again. I see that the status of issue become “Won’t fix”. What does it mean? Is this a problem with specific mesh?

@AkzhigitovAnton

We have investigated the logged ticket and found that it is not the issue as here is the code to get secondary UV coordinates:

var s = new Scene(@"uv_test.fbx");
var mesh = s.RootNode.ChildNodes[0].GetEntity<Mesh>();
var uvs = mesh.VertexElements.Where((ve) => ve is VertexElementUV).ToList();
// First UV coordinates
Console.WriteLine(uvs[0]);
// Second UV coordinates
Console.WriteLine(uvs[1]);

@asad.ali
Unfortunately this is not work as well. Moreover I tried to export same model to dae(collada) format. In dae there are no UVs at all.
dae_uvs_test.dae.zip (9.0 KB)
Both models were created with Blender 2.92

Maybe this issue is because I am working on macOS. I tried running test code from Unity3D editor with Mono scripting backend and .Net4.x Api Compatability level.
I have also tried .net core 3.1 console application also running on macOS. Same result in both situations: only 1 uv map in vertex elements for fbx and 0 for dae.
Sample code screenshot (67.0 KB)
Output screenshot (16.0 KB)

@AkzhigitovAnton

We again checked the code snippet at our end. It will throw a TrialException because multiple vertex element reached the unlicensed restriction. The guide in TrialException.Message will ask you to apply an license. After a valid license applied, there is more than one VertexElementUV in our environment. Please try to use 30-days free temporary license in order to test the case and let us know in case you face any issue.

@asad.ali
Everything works fine with the license.
Thanks for you patience.