Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

error when using SpecularGlossinessMaterial #48

Open
djmannion opened this issue Jul 19, 2019 · 2 comments · May be fixed by #64
Open

error when using SpecularGlossinessMaterial #48

djmannion opened this issue Jul 19, 2019 · 2 comments · May be fixed by #64

Comments

@djmannion
Copy link

Hi, thanks for this very useful library.

I was wondering if it is possible to use SpecularGlossinessMaterial?

I have tried editing example.py with:

bottle_material = pyrender.material.SpecularGlossinessMaterial()
bottle_mesh = Mesh.from_trimesh(bottle_trimesh, material=bottle_material)

but I receive an error:

Traceback (most recent call last):
  File "example.py", line 131, in <module>
    v = Viewer(scene, shadows=True)
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/viewer.py", line 347, in __init__
    self._init_and_start_app()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/viewer.py", line 1003, in _init_and_start_app
    pyglet.app.run()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyglet/app/__init__.py", line 142, in run
    event_loop.run()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyglet/app/base.py", line 164, in run
    self._legacy_setup()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyglet/app/base.py", line 253, in _legacy_setup
    window.dispatch_pending_events()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 877, in dispatch_pending_events
    EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyglet/event.py", line 370, in dispatch_event
    if handler(*args):
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/viewer.py", line 606, in on_resize
    self.on_draw()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/viewer.py", line 566, in on_draw
    self._render()
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/viewer.py", line 985, in _render
    self._renderer.render(self.scene, flags)
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/renderer.py", line 140, in render
    retval = self._forward_pass(scene, flags)
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/renderer.py", line 345, in _forward_pass
    primitive, flags, ProgramFlags.USE_MATERIAL
  File "/home/damien/venv/intrinsic_behav/lib/python3.7/site-packages/pyrender/renderer.py", line 952, in _get_primitive_program
    elif isinstance(material, SpecularGlossinessMaterial):
NameError: name 'material' is not defined
@keunhong
Copy link

keunhong commented Aug 22, 2019

SpecularGlossinessMaterial seems to be broken. I'm working on fixing it.

  1. The reference to material is undefined in the line your error occurrsed. It should be primitive.material.
  2. The class itself seems to be broken. The getter functions reference themselves rather than underscored member variables.
  3. mesh.py also doesn't load obj material properties and instead loads a default material of a texture image isn't present.
  4. The shader doesn't use the parameters from SpecularGlossinessMaterial at all.

@keunhong
Copy link

Preliminary implementation in #64

@keunhong keunhong linked a pull request Aug 23, 2019 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants