Giter VIP home page Giter VIP logo

Comments (10)

fire avatar fire commented on June 4, 2024

I tried making a merge uvs options to packing, but I couldn't get it to work.

from xatlas.

fire avatar fire commented on June 4, 2024

The index map gets difficult to calculate when you merge the meshes. Try to keep them separate.

from xatlas.

fire avatar fire commented on June 4, 2024

Got it to work.

from xatlas.

fire avatar fire commented on June 4, 2024

The repacked materials on different uvmeshes still need a way to ensure they're the same.

from xatlas.

 avatar commented on June 4, 2024

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.

fire avatar fire commented on June 4, 2024

bake

Here's an example of the bug.

from xatlas.

fire avatar fire commented on June 4, 2024

room_editor_baked
room_editor_original

Original vs Baked.

from xatlas.

jpcy avatar jpcy commented on June 4, 2024

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.

fire avatar fire commented on June 4, 2024

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.

 avatar commented on June 4, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.