xatlas

Python bindings for xatlas

https://github.com/mworchel/xatlas-python

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.8%) to scientific vocabulary

Keywords

atlas mesh parametrization python texture unwrapping uv xatlas
Last synced: 6 months ago · JSON representation

Repository

Python bindings for xatlas

Basic Info
  • Host: GitHub
  • Owner: mworchel
  • License: mit
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 626 KB
Statistics
  • Stars: 195
  • Watchers: 2
  • Forks: 21
  • Open Issues: 3
  • Releases: 9
Topics
atlas mesh parametrization python texture unwrapping uv xatlas
Created about 5 years ago · Last pushed 8 months ago
Metadata Files
Readme License

README.md

Python bindings for xatlas

(Unofficial) Python bindings for xatlas, a library that generates texture coordinates for triangle meshes.

Installation

From source

bash git clone --recursive https://github.com/mworchel/xatlas-python.git pip install ./xatlas-python

Using Pip

bash pip install xatlas

Usage

Parametrize a mesh and export it

```python import trimesh import xatlas

We use trimesh (https://github.com/mikedh/trimesh) to load a mesh but you can use any library.

mesh = trimesh.load_mesh("input.obj")

The parametrization potentially duplicates vertices.

vmapping contains the original vertex index for each new vertex (shape N, type uint32).

indices contains the vertex indices of the new triangles (shape Fx3, type uint32)

uvs contains texture coordinates of the new vertices (shape Nx2, type float32)

vmapping, indices, uvs = xatlas.parametrize(mesh.vertices, mesh.faces)

Trimesh needs a material to export uv coordinates and always creates a *.mtl file.

Alternatively, we can use the export helper function to export the mesh as obj.

xatlas.export("output.obj", mesh.vertices[vmapping], indices, uvs)

Both xatlas.parametrize and xatlas.export also accept vertex normals

```

Parametrize multiple meshes using one atlas

```python mesh1 = trimesh.loadmesh("input1.obj") mesh2 = trimesh.loadmesh("input2.obj")

atlas = xatlas.Atlas()

atlas.addmesh(mesh1.vertices, mesh1.faces) atlas.addmesh(mesh2.vertices, mesh2.faces)

Optionally parametrize the generation with

xatlas.ChartOptions and xatlas.PackOptions.

atlas.generate()

vmapping1, indices1, uvs1 = atlas[0] vmapping2, indices2, uvs2 = atlas[1] ```

Repack multiple parametrized meshes into one atlas

```python vertices1, indices1, uvs1 = loadmeshwithuvs("input1.obj") vertices2, indices2, uvs2 = loadmeshwithuvs("input2.obj")

atlas = xatlas.Atlas()

atlas.adduvmesh(uvs1, indices1) atlas.adduvmesh(uvs2, indices2)

atlas.generate()

vmapping1, indices1, uvs1 = atlas[0] vmapping2, indices2, uvs2 = atlas[1] ```

Query the atlas

``python atlas.mesh_count # Number of meshes len(atlas) # Convenience binding foratlas.meshcount` atlas.getmesh(i) # Data for the i-th mesh atlas[i] # Convenience binding for atlas.get_mesh

atlas.width # Width of the atlas atlas.height # Height of the atlas

atlas.utilization # Utilization of the first atlas atlas.get_utilization(i) # Utilization of i-th atlas

atlas.getmeshvertexassignement(i) # Returns two arrays, with the atlas index and # chart index of each vertex in the i-th mesh atlas.getmeshchartcount(i) # Returns the number of charts of the i-th mesh atlas.getmeshchart(i, j) # Returns the j-th chart of the i-th mesh

The image requires passing custom PackOptions:

pack_options = xatlas.PackOptions()

packoptions.createimage = True

atlas.generate(packoptions=packoptions)

atlas.chartimage # Debug image of the first atlas atlas.getchart_image(i) # Debug image of the i-th atlas

... # See xatlas documentation for all properties ```

License

The xatlas Python bindings are provided under a MIT license. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

References

Test model taken from the ABC dataset

Owner

  • Name: Markus Worchel
  • Login: mworchel
  • Kind: user
  • Location: Berlin, Germany
  • Company: TU Berlin

PhD student in Computer Graphics at TU Berlin. Interested in (inverse) rendering, geometry processing, differentiable programming, and GPGPU.

GitHub Events

Total
  • Create event: 5
  • Release event: 2
  • Issues event: 11
  • Watch event: 37
  • Delete event: 1
  • Issue comment event: 16
  • Push event: 26
  • Pull request event: 8
  • Fork event: 8
Last Year
  • Create event: 5
  • Release event: 2
  • Issues event: 11
  • Watch event: 37
  • Delete event: 1
  • Issue comment event: 16
  • Push event: 26
  • Pull request event: 8
  • Fork event: 8

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 83
  • Total Committers: 4
  • Avg Commits per committer: 20.75
  • Development Distribution Score (DDS): 0.301
Past Year
  • Commits: 16
  • Committers: 2
  • Avg Commits per committer: 8.0
  • Development Distribution Score (DDS): 0.125
Top Committers
Name Email Commits
Markus Worchel m****l@h****e 58
Michael Dawson-Haggerty m****h@k****m 14
Markus Worchel 9****l 10
Michele Sanna {****} 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 17
  • Total pull requests: 12
  • Average time to close issues: 9 months
  • Average time to close pull requests: 10 days
  • Total issue authors: 13
  • Total pull request authors: 4
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.92
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 8
  • Average time to close issues: 3 months
  • Average time to close pull requests: 14 days
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 2.2
  • Average comments per pull request: 1.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • yongsiang-fb (3)
  • mifth (3)
  • impiaaa (1)
  • emres8 (1)
  • kashyappiyush1998 (1)
  • lthiet (1)
  • manuel-koch (1)
  • expenses (1)
  • joamatab (1)
  • zbx99 (1)
  • codetea-fly (1)
  • mikedh (1)
Pull Request Authors
  • mworchel (6)
  • mikedh (4)
  • mgorny (2)
  • mich-sanna (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 223,061 last-month
  • Total docker downloads: 1,378
  • Total dependent packages: 6
  • Total dependent repositories: 51
  • Total versions: 10
  • Total maintainers: 1
pypi.org: xatlas

Python bindings for xatlas

  • Homepage: https://github.com/mworchel/xatlas-python
  • Documentation: https://xatlas.readthedocs.io/
  • License: MIT License Copyright (c) 2021 Markus Worchel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.0.11
    published 8 months ago
  • Versions: 10
  • Dependent Packages: 6
  • Dependent Repositories: 51
  • Downloads: 223,061 Last month
  • Docker Downloads: 1,378
Rankings
Downloads: 1.3%
Dependent packages count: 1.9%
Dependent repos count: 2.1%
Docker downloads count: 2.1%
Average: 4.6%
Stargazers count: 6.8%
Forks count: 13.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/install-and-test.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/wheels.yml actions
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v2 composite
  • pypa/cibuildwheel v2.11.3 composite
  • pypa/gh-action-pypi-publish v1.4.2 composite
pyproject.toml pypi
  • numpy *
setup.py pypi