Giter VIP home page Giter VIP logo

Comments (9)

mikedh avatar mikedh commented on May 31, 2024 5

Hey, GLB can contain multiple geometries and a scene graph, so the return type is a trimesh.Scene to contain that information. If you run the pyrender scene conversion it should work:
pyrender.Scene.from_trimesh_scene(fuz_trimesh)

There are a few formats that can return a Scene OR a Trimesh (OBJ), it might be nice someday to have something like pyrender.utils.from_trimesh that could handle any input.

from pyrender.

dentraTech avatar dentraTech commented on May 31, 2024 1

import trimesh
import pyrender
fuz_trimesh = trimesh.load("donut_calibrate2_forgltf.glb")
mesh = pyrender.Mesh.from_trimesh(fuz_trimesh)

In the line 3 if you want to force it to return a Mesh object, instead of a scene object try to use 'force' option of .load() method.
Example:
fuz_trimesh = trimesh.load("donut_calibrate2_forgltf.glb", force='mesh')

There are other force options inside this method. you can look into the documentation for detailed info.

from pyrender.

tiancaipipi110 avatar tiancaipipi110 commented on May 31, 2024

Thanks and yes. Just tried again, it was able to convert scene. But then it's getting another error.

scene = pyrender.Scene()
scene.add(mesh) 

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python36\lib\site-packages\pyrender\scene.py", line 286, in add
    raise TypeError('Unrecognized object type')
TypeError: Unrecognized object type

Hmm, is it able to import armature?

from pyrender.

mikedh avatar mikedh commented on May 31, 2024

I think you want:
scene = pyrender.Scene.from_trimesh_scene(fuz_trimesh)

from pyrender.

tiancaipipi110 avatar tiancaipipi110 commented on May 31, 2024

 ̄□ ̄| | Thank you. Another question: I'm trying to visualize animation clip by pyrender.Viewer(scene, use_raymond_lighting=True, run_in_thread=True) Then got error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception in thread Thread-5:
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python36\lib\site-packages\pyrender\viewer.py", line 997, in _init_and_start_app
    height=self._viewport_size[1])
  File "C:\Program Files\Python36\lib\site-packages\pyglet\window\win32\__init__.py", line 137, in __init__
    super(Win32Window, self).__init__(*args, **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\window\__init__.py", line 592, in __init__
    config = screen.get_best_config(config)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\canvas\base.py", line 195, in get_best_config
    configs = self.get_matching_configs(template)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\canvas\win32.py", line 67, in get_matching_configs
    configs = template.match(canvas)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\gl\win32.py", line 58, in match
    return self._get_arb_pixel_format_matching_configs(canvas)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\gl\win32.py", line 129, in _get_arb_pixel_format_matching_configs
    wglext_arb.wglChoosePixelFormatARB(canvas.hdc, attrs, None, nformats, pformats, nformats)
  File "C:\Program Files\Python36\lib\site-packages\pyglet\gl\lib.py", line 63, in MissingFunction
    raise MissingFunctionException(name, requires, suggestions)
pyglet.gl.lib.MissingFunctionException: wglChoosePixelFormatARB is not exported by the available OpenGL driver.  ARB_pixel_format is required for this functionality.

  File "C:\Program Files\Python36\lib\site-packages\pyglet\window\__init__.py", line 661, in __repr__
    (self.__class__.__name__, self.width, self.height)
TypeError: %d format: a number is required, not NoneType

from pyrender.

zdw-qingdao avatar zdw-qingdao commented on May 31, 2024

same problem, is this fixed?

from pyrender.

lix4 avatar lix4 commented on May 31, 2024

same problem, is this fixed?

You can create a list to load all elements in the trimesh.geometry.values() and add them into scene one by one

from pyrender.

HoseinHashemi avatar HoseinHashemi commented on May 31, 2024

This does not work.

from pyrender.

HoseinHashemi avatar HoseinHashemi commented on May 31, 2024

I have the same problem when loading a .ply file.

from pyrender.

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.