Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[BUG] Render multiple Cylinder and hash() #388

Open
ucacaxm opened this issue Dec 11, 2024 · 0 comments
Open

[BUG] Render multiple Cylinder and hash() #388

ucacaxm opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ucacaxm
Copy link

ucacaxm commented Dec 11, 2024

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

@ucacaxm ucacaxm added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants