rnd-team-dev / plotoptix

Data visualisation and ray tracing in Python based on OptiX 7.7 framework.
https://rnd.team/plotoptix
Other
499 stars 26 forks source link

Error on changing material #55

Closed JRGit4UE closed 1 year ago

JRGit4UE commented 1 year ago

In v0.17 TkOptiX, with RTX 3090, driver 536.23 when I want to change the material of a loaded .OBJ file

rt.setup_material("cover", m_matt_plastic)
rt.setup_material("flat", m_flat)

rt.load_merged_mesh_obj(mesh_path, mesh_name="test1", c=0.92, mat='cover')
rt.set_data("test2", geom="Parallelepipeds", pos=[(-20, 0, -20)], u=[300, 0, 0], v=[0, 0, 300], w=[0, thickness, 0], c=0.5,
            mat="my_loaded_jpg_texture")

and when I try to change the material of test1 in the callback of


def update_scene(rt: TkOptiX) -> None:
        rt.set_data('test1', mat='flat')  # DOES NOT WORK
        # rt.update_data('test1', mat='flat')  # DOES NOT WORK EITHER
        rt.set_data('test2', mat='flat')  # DOES WORK

rt = TkOptiX(on_rt_completed=update_scene)

I get an

ERROR] (Dummy-21 ) Geometry update failed.**

for changing test1. Changing test2 works without any issue... What might be the problem here?

JRGit4UE commented 1 year ago

Fixed it: update_mesh() instead of update_data() does the trick