Skip to content

[Bug]: Luisa batch rendering with partnet mobility object #2156

@NakuraMino

Description

@NakuraMino

Bug Description

luisa renderer is able to render a partnet mobility object when i use the default gs.renderers.RayTracer but errors when I use gs.renderers.BatchRenderer(use_rasterizer=False).

Steps to Reproduce

If possible, provide a script triggering the bug, e.g.

# code snippet triggering the bug
import genesis as gs
import numpy as np
from matplotlib import pyplot as plt

BATCH_RENDERING = False

if BATCH_RENDERING:
    # batch rendering fails
    gs.init(backend=gs.gpu)

    scene = gs.Scene(
        rigid_options=gs.options.RigidOptions(enable_collision=False, gravity=(0, 0, 0)),
        show_viewer=False,
        renderer=gs.renderers.BatchRenderer(
            use_rasterizer=False
        ),
    )

    scene.add_light(
        pos=(0.0, 0.0, 5.0),
        color=(1.0, 1.0, 1.0),
        intensity=1.0,
        dir=(0.0, 0.0, -1.0),
    )
    

    plane = scene.add_entity(
        morph=gs.morphs.Plane(pos=(0.0, 0.0, -0.5)),
    )

    franka = scene.add_entity(
        gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
    )

    camera1 = scene.add_camera(
        res=(640, 480),
        pos=(0.5, -3.0, 2.5),
        lookat=(0.5, 0.0, 0.2),
        fov=60,
        GUI=False,
    )

    camera2 = scene.add_camera(
        res=(640, 480),
        pos=(0.5, 3.0, 2.5),
        lookat=(0.5, 0.0, 0.2),
        fov=60,
        GUI=False,
    )

    obj = scene.add_entity(
        material=gs.materials.Rigid(friction=5.0),
        morph=gs.morphs.URDF(
            file='/path/to/partnet-mobility/45524/mobility.urdf',
            scale=0.5,
            pos=(0.8,0,0.4),
            quat = (1,0,0,0),
            fixed=True
            )
    )

    scene.build()
    scene.step()
    rgb, depth, seg, normals = scene.render_all_cameras(rgb=True)
    plt.imshow(np.concatenate((rgb[0].cpu().numpy(), rgb[1].cpu().numpy()), axis=1))
    plt.show()


else:
    # non batch rendering:
    gs.init(backend=gs.gpu)

    scene = gs.Scene(
        rigid_options=gs.options.RigidOptions(enable_collision=False, gravity=(0, 0, 0)),
        viewer_options=gs.options.ViewerOptions(
            res=(1920, 1080),
            camera_pos=(8.5, 0.0, 4.5),
            camera_lookat=(3.0, 0.0, 0.5),
            camera_fov=50,
        ),
        renderer=gs.renderers.RayTracer(  # type: ignore
            env_surface=gs.surfaces.Emission(
                emissive_texture=gs.textures.ImageTexture(
                    image_path="textures/indoor_bright.png",
                ),
            ),
            env_radius=15.0,
            env_euler=(0, 0, 180),
            lights=[
                {"pos": (0.0, 0.0, 10.0), "radius": 3.0, "color": (15.0, 15.0, 15.0)},
            ],
        ),
    )

    plane = scene.add_entity(
        morph=gs.morphs.Plane(pos=(0.0, 0.0, -0.5)),
    )

    franka = scene.add_entity(
        gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
    )

    camera1 = scene.add_camera(
        res=(640, 480),
        pos=(0.5, -3.0, 2.5),
        lookat=(0.5, 0.0, 0.2),
        fov=60,
        GUI=False,
    )

    camera2 = scene.add_camera(
        res=(640, 480),
        pos=(0.5, 3.0, 2.5),
        lookat=(0.5, 0.0, 0.2),
        fov=60,
        GUI=False,
    )

    obj = scene.add_entity(
        material=gs.materials.Rigid(friction=5.0),
        morph=gs.morphs.URDF(
            file='/path/to/partnet-mobility/45524/mobility.urdf',
            scale=0.5,
            pos=(0.8,0,0.4),
            quat = (1,0,0,0),
            fixed=True
            )

    )

    scene.build()
    scene.step()
    rgb1, depth, seg, normals = camera1.render(rgb=True)
    rgb2, depth, seg, normals = camera2.render(rgb=True)
    
    plt.imshow(np.concatenate((rgb1, rgb2), axis=1))
    plt.show()

45524.zip

Expected Behavior

batch rendering returns the same output as when I use the default RayTracer.

On another note, the color of the object also changes when I use the raytracer vs default rasterizer, which I don't understand.

Screenshots/Videos

Image Image

Relevant log output

By toggling the BATCH_RENDERING flag, you should be able to see the error output. The error I get is the following: 

[Genesis] [03:38:51] [INFO] Compiling simulation kernels...
[Genesis] [03:38:57] [INFO] Building visualizer...
Using raytracer
All Vulkan layers supported
free(): invalid next size (fast)

Environment

  • OS: Ubuntu 20.04
  • GPU/CPU 2x RTX 4090s, AMD Ryzen Threadripper PRO 5975WX 32-Cores
  • GPU-driver version 550.90.07
  • CUDA / CUDA-toolkit version 12.1

Release version or Commit ID

version 0.3.6

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions