Comments (10)
I tried making a merge uvs options to packing, but I couldn't get it to work.
from xatlas.
The index map gets difficult to calculate when you merge the meshes. Try to keep them separate.
from xatlas.
Got it to work.
from xatlas.
The repacked materials on different uvmeshes still need a way to ensure they're the same.
from xatlas.
I tried making a merge uvs options to packing, but I couldn't get it to work.
The repacked materials on different uvmeshes still need a way to ensure they're the
same.
What are you trying to accomplish? I'm not sure if this is what you want, but I have some code which loops through meshes of a model and maps each vertex to a material on a single vector container.
This is how I get the material index back for the mesh vertex from that container: https://github.com/multitheftauto/mtasa-blue/blob/fc2fe14de3f7e01dc477dff2c675bfab0c3b5e84/Client/core/C3DModelOptimizer.cpp#L527
Since you mentioned that you are "merging" them, I'm guessing that you are calling xatlas::AddUvMesh
once for the model. If that's the case, the idea is still the same, you can access the material index for a mesh from the merged meshes the same way.
from xatlas.
Here's an example of the bug.
from xatlas.
Original vs Baked.
from xatlas.
It's not really a bug, this library deals with unique parameterizations.
The UvMesh chart detection looks for connected faces in UV space, which is fine for unique parameterizations. But faces that aren't connected in worldspace and have overlapping or duplicate edges in UV space (i.e. not unique) will be detected as belonging to the same chart. That happens to be what you want, but only by coincidence.
Charts are per-mesh, so if you want that behavior for the whole atlas, merge all mesh geometry so you're only adding a single mesh.
from xatlas.
Won't overlapping UVs for the same mesh be a problem? There's also the problem linking the specific uv to a unique material when we merge the mesh first.
Is it possible to have the consistent material to vertex mappings over an array of ids?
For example:
Mesh 0:
- index 0 goes to material idx 0
- index 1 goes to material idx 0
- index 2 goes to material idx 0
Mesh 1:
- index 0 goes to material idx 1
- index 1 goes to material idx 1
- index 2 goes to material idx 1
You're suggesting I do this.
- index 0 goes to material idx 0
- index 1 goes to material idx 0
- index 2 goes to material idx 0
- index 3 goes to material idx 1
- index 4 goes to material idx 1
- index 5 goes to material idx 1
I'll try it.
from xatlas.
@fire Why don't you just ignore the materials which take up too much space in the atlas? It might result in one or two extra draw calls, but you'll save memory.
from xatlas.
Related Issues (20)
- enhancement packing charts HOT 2
- Is it possible to get the texture from the UV construction? HOT 1
- Merging charts is too slow
- xatlas cause memory leak
- Two questions
- faceVertexCount pb
- Consider restoring texture repack example?
- Question about checking for zero-area-faces?
- Getting Face Materials from Packed Mesh
- co_await support
- Question: mesh transforms
- webassembly build for in browser usage? HOT 1
- How to use this library for regenerating Diffuse UV maps in Unreal Engine? HOT 3
- unity il2cpp build faild HOT 1
- Binaries are missing (No releases published) HOT 1
- Vertices are moved to zero HOT 9
- Off-by-one error in nlCRSMatrixNewFromSparseMatrix
- How to allow xatlas to split charts into smaller chunks for minimizing output atlas size HOT 5
- set the size of faces HOT 1
- Keep original UVs? HOT 1
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 xatlas.