Comments (9)
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.
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.
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.
I think you want:
scene = pyrender.Scene.from_trimesh_scene(fuz_trimesh)
from pyrender.
 ̄□ ̄| | 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.
same problem, is this fixed?
from pyrender.
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.
This does not work.
from pyrender.
I have the same problem when loading a .ply file.
from pyrender.
Related Issues (20)
- error in material.SpecularGlossinessMaterial()
- Request for Assistance: Obtaining Pixel-to-Face Index in Pyrender
- BROKEN LINK: Google colab notebooks HOT 1
- Invalid device ID (0), Pyrender NOT working on Python 3.10 HOT 5
- Inverted triangles?
- How to retrieve intrinsic camera parameters from PerspectiveCamera
- Textures rendering slanted
- Sphere Rendered with Non-reflective Material Not Appearing Black
- offscreen error
- 'Viewer' object has no attribute 'render'. Did you mean: '_render'?
- Interpolation artifacts in segmentation masks.
- Unable to get color on running the bottle example code HOT 1
- Wrong depth rendering in WSL-ubuntu environment
- Path3D type error when loading trimesh scene
- GLB is not rendered correctly HOT 1
- How to properly merge the Scenes from multiple trimeshes?
- Request for Release of Tag 0.1.46 with auto_start Option
- Cannot render SpecularGlossinessMaterial HOT 1
- jupyter notebook support?
- Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling HOT 3
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 pyrender.