-
Notifications
You must be signed in to change notification settings - Fork 349
Description
Bug Description
Hi,
Thanks for the job around Warp !
I like the OpenGLRenderer for interactive visualization.
If I try to render 2 cylinders with different color
or up_axis
like this
(but with the same radius and half_height):
renderer.render_cylinder(
name="_cylinder_X",
pos=wp.vec3f(0.5,2,0),
rot=wp.quat_identity(),
radius=0.02,
half_height=0.5,
up_axis = 0,
color = (1.0, 0.0, 0.0)
)
renderer.render_cylinder(
name = "_cylinder_Y",
pos = wp.vec3f(0.5, 2,0),
rot = wp.quat_identity(),
radius=0.02,
half_height=0.5,
up_axis = 1,
color = (0.0, 1.0, 0.0)
)
It renders only one cylinder.
If I want the second cylinder, I have to change a bit his half_height
like this
half_height=0.5+0.00001,
This is because of the code in warp/render/render_opengl.py
line 2821, function def render_cylinder(...
geo_hash = hash(("cylinder", radius, half_height))
Same radius and height give one unique object, whereas up_axis
should get another one (or at least change the rotation).
If only the color
or the up_axis
change, this line will reuse (and update) the same existing cylinder.
This is also the case for Sphere, Arrow, Plane, Capsule, etc. with the at least the color
parameter.
Maybe I would suggest to add the name
of the object in the hashing ?
geo_hash = hash(("cylinder"+name, radius, half_height))
If the user want to update an object, he calls again render_cylinder
with different parameters and keep the same name,
if he wants a Nth object he changes the name.
Or adding the color
and the up_axis
in the hashing.
This has also to be update for Arrow, Capsule, etc.
Thank you,
PS: If you are ok with adding the name
in the hashing, I can also do a pull request ...
System Information
No response