Giter VIP home page Giter VIP logo

xatlas-python's People

Contributors

mikedh avatar mworchel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xatlas-python's Issues

Export an charts image like example.cpp in xatlas

Thanks for the great bindings.

I want to export tga images just like example.cpp provided in xatlas but I meet a problem that I can't find how to get message about chartArray I can only get the value of chart_count.
This is the part of example.cpp. I have no idea about how to get chartArray.I am new at this.If there is something I didn't correctly understand,please tell me. Thank you.
for (uint32_t j = 0; j < mesh.chartCount; j++) { const xatlas::Chart *chart = &mesh.chartArray[j]; uint8_t color[3]; RandomColor(color); for (uint32_t k = 0; k < chart->faceCount; k++) { const uint32_t face = chart->faceArray[k];

When number of sub-atlases > 1, cannot distinguish which to use for output vertices

Describe the bug

If we set xatlas.PackOptions.resolution to be a small number, it is possible for the output atlas.atlas_count to be greater than 1. That is, the output contains several sub-atlases. In such cases, we have to use Vertex.atlasIndex to check which sub-atlas is used by each vertex. However, xatlas-python does not output such information, making it impossible to distinguish which sub-atlas to be used.

Expected behavior
xatlas-python should output Vertex.atlasIndex for each vertex.

get stucked at xatlas.parameterize()

Hi,
Thanks for the great work! However, i run into a problem when using. I run the example code of the ReadMe, but the program will be stucked(still running after about 40min) when running the code xatlas.parameterize(). do you have any ideas about that?
The env:
WSL in windows(Ubuntu)
3D model file: The bunny

Functions are not visible

When I try to execute given example under the "Parametrize a mesh and export it" section I encountered with following error:

line 12, in
vmapping, indices, uvs = xatlas.parametrize(mesh.vertices, mesh.faces)
AttributeError: module 'xatlas' has no attribute 'parametrize'

I both tried to install directly from pip and also clone the repo.

UV and normal parameters in "add_mesh" swapped

Similar to #4, the binding says that the last two parameters are "uvs" and "normals":

.def("add_mesh", &Atlas::addMesh, py::arg("positions"), py::arg("indices"), py::arg("uvs") = std::nullopt, py::arg("normals") = std::nullopt)

but Atlas::addMesh actually takes "normals" and then "uvs":
void Atlas::addMesh(ContiguousArray<float> const& positions,
ContiguousArray<std::uint32_t> const& indices,
std::optional<ContiguousArray<float>> normals,
std::optional<ContiguousArray<float>> uvs)

`/tmp/pip-build-env-<whatever>/overlay/bin/ninja --version` fails when trying to install for Blender

Describe the bug

Hi. I'm trying to write an addon for Blender that uses this package as an improvement over the existing addon: https://github.com/mattedicksoncom/blender-xatlas.

I started out by trying to install the package into Blender's python install.

I cd'd into blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python

and ran ./bin/python3.10 -m pip install ~/projects/xatlas-python -t lib/site-packages -vvv. This output the following log:

Using pip 22.2.2 from /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip (python 3.10)
Non-user install due to --prefix or --target option
Created temporary directory: /tmp/pip-target-ez6a_g3g
Created temporary directory: /tmp/pip-ephem-wheel-cache-nc14u70s
Created temporary directory: /tmp/pip-build-tracker-e5pq8mwf
Initialized build tracking at /tmp/pip-build-tracker-e5pq8mwf
Created build tracker: /tmp/pip-build-tracker-e5pq8mwf
Entered build tracker: /tmp/pip-build-tracker-e5pq8mwf
Created temporary directory: /tmp/pip-install-0075r_n0
Processing /home/ashley/projects/lighting/xatlas-python
  Added file:///home/ashley/projects/lighting/xatlas-python to build tracker '/tmp/pip-build-tracker-e5pq8mwf'
  Created temporary directory: /tmp/pip-build-env-8_ga30lr
  Running command pip subprocess to install build dependencies
  Using pip 22.2.2 from /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip (python 3.10)
  Collecting setuptools>=42
    Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)
  Collecting wheel
    Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
  Collecting ninja
    Using cached ninja-1.11.1-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (145 kB)
  Collecting cmake>=3.12
    Using cached cmake-3.25.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.7 MB)
  Installing collected packages: ninja, cmake, wheel, setuptools
    Creating /tmp/pip-build-env-8_ga30lr/overlay/bin
    changing mode of /tmp/pip-build-env-8_ga30lr/overlay/bin/ninja to 755
    changing mode of /tmp/pip-build-env-8_ga30lr/overlay/bin/cmake to 755
    changing mode of /tmp/pip-build-env-8_ga30lr/overlay/bin/cpack to 755
    changing mode of /tmp/pip-build-env-8_ga30lr/overlay/bin/ctest to 755
    changing mode of /tmp/pip-build-env-8_ga30lr/overlay/bin/wheel to 755
  ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
  trimesh 3.9.1 requires numpy, which is not installed.
  <...snip...>
  Successfully installed cmake-3.25.0 ninja-1.11.1 setuptools-65.6.3 wheel-0.38.4

  [notice] A new release of pip available: 22.2.2 -> 22.3.1
  [notice] To update, run: /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/bin/python3.10 -m pip install --upgrade pip
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  running egg_info
  writing xatlas.egg-info/PKG-INFO
  writing dependency_links to xatlas.egg-info/dependency_links.txt
  writing top-level names to xatlas.egg-info/top_level.txt
  reading manifest file 'xatlas.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching 'extern/pybind11/LICENSE'
  warning: no files found matching 'extern/xatlas/LICENSE'
  warning: no directories found matching 'extern/pybind11/include'
  warning: no directories found matching 'extern/pybind11/tools'
  warning: no directories found matching 'extern/xatlas/source/xatlas'
  adding license file 'LICENSE'
  writing manifest file 'xatlas.egg-info/SOURCES.txt'
  Getting requirements to build wheel ... done
  Created temporary directory: /tmp/pip-modern-metadata-mhmxsvjc
  Running command Preparing metadata (pyproject.toml)
  running dist_info
  creating /tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info
  writing /tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/dependency_links.txt
  writing top-level names to /tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/top_level.txt
  writing manifest file '/tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching 'extern/pybind11/LICENSE'
  warning: no files found matching 'extern/xatlas/LICENSE'
  warning: no directories found matching 'extern/pybind11/include'
  warning: no directories found matching 'extern/pybind11/tools'
  warning: no directories found matching 'extern/xatlas/source/xatlas'
  adding license file 'LICENSE'
  writing manifest file '/tmp/pip-modern-metadata-mhmxsvjc/xatlas.egg-info/SOURCES.txt'
  creating '/tmp/pip-modern-metadata-mhmxsvjc/xatlas-0.0.6.dist-info'
  Preparing metadata (pyproject.toml) ... done
  Source in /home/ashley/projects/lighting/xatlas-python has version 0.0.6, which satisfies requirement xatlas==0.0.6 from file:///home/ashley/projects/lighting/xatlas-python
  Removed xatlas==0.0.6 from file:///home/ashley/projects/lighting/xatlas-python from build tracker '/tmp/pip-build-tracker-e5pq8mwf'
Created temporary directory: /tmp/pip-unpack-kkwy4l84
Building wheels for collected packages: xatlas
  Created temporary directory: /tmp/pip-wheel-plugb7yr
  Destination directory: /tmp/pip-wheel-plugb7yr
  Running command Building wheel for xatlas (pyproject.toml)
  running bdist_wheel
  running build
  running build_ext
  CMake Error at CMakeLists.txt:3 (project):
    Running

     '/tmp/pip-build-env-yc_hsrdw/overlay/bin/ninja' '--version'

    failed with:

     No such file or directory


  -- Configuring incomplete, errors occurred!
  See also "/home/ashley/projects/lighting/xatlas-python/build/temp.linux-x86_64-cpython-310/CMakeFiles/CMakeOutput.log".
  ['CMakeFiles', 'extern', 'src', 'CMakeCache.txt']
  Traceback (most recent call last):
    File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 413, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
      exec(code, locals())
    File "<string>", line 108, in <module>
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 325, in run
      self.run_command("build")
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1208, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
      self.build_extensions()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 468, in build_extensions
      self._build_extensions_serial()
    File "/tmp/pip-build-env-8_ga30lr/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 494, in _build_extensions_serial
      self.build_extension(ext)
    File "<string>", line 98, in build_extension
    File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '/home/ashley/projects/lighting/xatlas-python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/ashley/projects/lighting/xatlas-python/build/lib.linux-x86_64-cpython-310/', '-DPYTHON_EXECUTABLE=/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/bin/python3.10', '-DVERSION_INFO=0.0.6', '-DCMAKE_BUILD_TYPE=Release', '-GNinja']' returned non-zero exit status 1.
  error: subprocess-exited-with-error

  × Building wheel for xatlas (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/bin/python3.10 /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpdf0obfx3
  cwd: /home/ashley/projects/lighting/xatlas-python
  Building wheel for xatlas (pyproject.toml) ... error
  ERROR: Failed building wheel for xatlas
Failed to build xatlas
ERROR: Could not build wheels for xatlas, which is required to install pyproject.toml-based projects
Exception information:
Traceback (most recent call last):
  File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 431, in run
    raise InstallationError(
pip._internal.exceptions.InstallationError: Could not build wheels for xatlas, which is required to install pyproject.toml-based projects
Remote version of pip: 22.3.1
Local version of pip:  22.2.2
Was pip installed by pip? True

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: /home/ashley/Downloads/blender-3.5.0-alpha+master.9719fd696488-linux.x86_64-release/3.5/python/bin/python3.10 -m pip install --upgrade pip
Removed build tracker: '/tmp/pip-build-tracker-e5pq8mwf'

I don't know if this is a problem that xatlas-python specifically can address, but I'm reporting it anyway because it's an issue for me. I'll post back here if I figure out a solution.

To Reproduce
Steps to reproduce the behavior:

  1. Download a Blender build
  2. Do what I did, essentially

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: Arch Linux x86_64 6.0.11-arch1-1
  • Version: commit fd89629 of python-xatlas

Is it possible to get the texture from the UV construction?

Thanks a lot for the bindings!

I am using the bindings to create a mesh with UV mapping from 3d scans. For each point, I have an associated color and with open3d I managed to make a colored mesh.

image

Now I am using Atlas to generate UV mapping, but I don't know how I can get a texture from it so I can use it in Unity for example.

Do you know how I could do that?

upstream support

Thanks for the great bindings and work to package them nicely with cibuildwheel!

I was thinking about switching the trimesh.Trimesh.unwrap function to use these bindings, and I was wondering if the issue in the README (about the trimesh OBJ exporter not correctly parametrizing faces) was just the auto-vertex merging, or something else? In unit tests the trimesh PR adding xatlas support is checking order of the new mesh and of the OBJ.

I'm definitely not in love with trimesh's OBJ export at all hahah, but I would like to if possible solve the upstream issue too. Thanks!

Support for `xatlas::AddUvMesh`?

Hi,

Thanks for making the great Python binding!

Would it be possible to add support to the xatlas::AddUvMesh method, please? It is quite useful when repacking existing textures. The current binding only supports xatlas::AddMesh.

Incorrect parameter name

In this line, the third argument should actually be normals rather than uvs. The fourth argument should actually be uvs rather than normals.

m.def("parametrize", &parametrize, py::arg("positions"), py::arg("indices"), py::arg("uvs") = std::nullopt, py::arg("normals") = std::nullopt);

UV Layout Export as transparent png file

I was trying to use blender python as my UV unwrapped, but when I need UV layout to be exported it needs a display to draw, which is not feasible for me. Then I discovered that xatlas is also able to do that, but I do not know if it is able to export UV as a layout. It would be very helpful for me to have this feature added.
Thank You

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.