Comments (8)
The map file is intended to contain:
newIndex,oldIndex
This means that vertex newIndex
in the new mesh came originally from oldIndex
in the original mesh. This is supposed to account for both duplicates from the clean process and the new parameterization.
from uvatlas.
Thank you for your reply. That is actually what I thought the _map.txt indicates, but what I found out later in my experimental results somewhat baffled me. For example, I still used this per-vertex-color OBJ as input original mesh original mesh, then I applied "-t -c -m -wf" switches on this input mesh to generate a new mesh together with a resulting _map.txt file. This _map.txt looks like below:
0,0
1,1
2,2
...
This pattern of same newIndex vs. oldIndex goes all the way down till line#67151 before the newIndex and oldIndex are different. I assume this means the new indices 0, 1, and 2 in the new mesh corresponds to old indices 0, 1, and 2 in the original mesh, respectively. However, the 3D coordinates of vertices 0, 1, and 2 in the original mesh are:
v 0.236947 -1.026314 0.613356
v -1.028812 -0.994679 0.613356
v 0.490099 -1.011664 0.613356
while the 3D coordinates of vertices 0, 1, and 2 in the new mesh are:
v -0.522509 -1.03974 0.676644
v -0.522509 -1.03742 0.657444
v -0.556232 -1.03742 0.676644
These two set of 3D coordinates look quite different. I previously thought they should be similar if not exactly the same, since no large scale spatial transformation is required for the mesh partition. Then what did I do wrong?
Thank you very much!
from uvatlas.
What if you try without the -t -c
switches?
from uvatlas.
I just tried "-m -wf" as you advised. The results still show mismatches between the vertices in the original mesh and the vertices in the new mesh.
from uvatlas.
How am I supposed to read the map.txt file in the first place?
I also noticed the vertex positions to be shuffled to some degree.
I am using uvatlastool.exe from C# and I am not sure how to transfer the UVs of the new mesh to the old mesh.
My function looks like this:
private void ApplyLightmapUVs(ref RoomMesh mesh, StreamReader resultMeshReader, StreamReader mappingReader)
{
List<Vector2> newUVs = new List<Vector2>();
using (resultMeshReader)
{
string line = resultMeshReader.ReadLine();
while (line != null)
{
if (line.StartsWith("vt"))
{
var splits = line.Split(" ");
var u = float.Parse(splits[1]);
var v = float.Parse(splits[2]);
newUVs.Add(new Vector2(u, v));
}
line = resultMeshReader.ReadLine();
}
}
using (mappingReader)
{
string line = mappingReader.ReadLine();
while (line != null)
{
var splits = line.Split(",");
var oldIdx = int.Parse(splits[1]);
var newIdx = int.Parse(splits[0]);
RoomVertex oldVertex = mesh.Vertices[oldIdx];
RoomVertex newVertex = oldVertex;
newVertex.LightmapUV = newUVs[newIdx]; // apply new UVs
mesh.Vertices[oldIdx] = newVertex;
line = mappingReader.ReadLine();
}
}
ExportRoomToOBJ(mesh, "Temp/test.obj",true); // sanity check. shows messed up UVs
}
resultMeshReader
is the obj file of the result mesh after uvatlastool.exe.
mappingReader
is the mapping file.
However, the obj I export for a sanity check has messed up UVs.
I have attached all meshes
Temp.zip
from uvatlas.
Related Issues (20)
- Build failure on manual link source code.(whitout vcpkg)
- Why UVAtlasCreate()'s Parameter "vMeshOutIndexBuffer" is type of uint8_t? HOT 1
- Parameter `callbackFrequency` seems to have no effect HOT 2
- loading an obj doesnt work HOT 10
- Why 2 partitions in 1 iteration?
- Export UV map in Numpy format
- Why the number of vertices is increased? HOT 5
- How to make consistent UV atlases? HOT 1
- Retire VS 2017 support HOT 1
- ARM64 version of uvatlastool HOT 2
- UVAtlas exe stuck on 33.3% HOT 1
- How to compile UVAtlasTool under linux? HOT 4
- Why divided by f3dArea in IMT computation? HOT 1
- How to flatten a partitioned 3D mesh onto 2D UV map? HOT 17
- Non-deterministic UVAtlas parameterization HOT 4
- uvatlastool generates additional vertices with already-unique faces HOT 2
- How to use the new texture coordinates (UV) generated by UVAtlas to render the 3D object? HOT 3
- [problem] UV triangles will overlap/conflict HOT 2
- Retire legacy Xbox One XDK support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uvatlas.