Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

[Bug]: The "lights" in RayTracer will cause the camera to have only black frames

Open BugDigK opened this issue 2 months ago • 0 comments

Bug Description

When I use the following code to add "lights" in RayTracer, the viewer displays correctly, but the camera fails to render the image properly. No errors were found in the console. How could I solve this bug? Could "color" use both integer and float? Thank you.

### Steps to Reproduce

import genesis as gs

gs.init()

scene = gs.Scene(
    show_viewer=True,
    viewer_options=gs.options.ViewerOptions(
        res=(1280, 960),
        camera_pos=(3.5, 0.0, 2.5),
        camera_lookat=(0.0, 0.0, 0.5),
        camera_fov=40,
        max_FPS=60,
    ),
    vis_options=gs.options.VisOptions(
        show_world_frame=True,
        world_frame_size=1.0,
        show_link_frame=False,
        show_cameras=False,
        plane_reflection=True,
        ambient_light=(0.1, 0.1, 0.1),
    ),
    # renderer=gs.renderers.RayTracer(),
    renderer=gs.renderers.RayTracer(
        lights=[
                    {"pos": (0.0, -0.25, 3.0), "radius": 3.0, "color": (1.2, 1.0, 0.8), 'intensity': 5.0}, 
                ],)
    # renderer=gs.renderers.Rasterizer(),
)

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

cam = scene.add_camera(
    res=(640, 480),
    pos=(3.5, 0.0, 2.5),
    lookat=(0, 0, 0.5),
    fov=30,
    GUI=False,
)

scene.build()

# render rgb, depth, segmentation, normal
rgb, depth, segmentation, normal = cam.render(rgb=True, depth=True, segmentation=True, normal=True)

cam.start_recording()
import numpy as np

for i in range(120):
    scene.step()
    cam.set_pose(
        pos=(3.0 * np.sin(i / 60), 3.0 * np.cos(i / 60), 2.5),
        lookat=(0, 0, 0.5),
    )
    cam.render()
cam.stop_recording(save_to_filename="video.mp4", fps=60)

Expected Behavior

fix

Screenshots/Videos

https://github.com/user-attachments/assets/58c1874b-8ccc-45f1-9099-c4691c5bbfc8

Relevant log output


Environment

  • OS: Ubuntu 24.04
  • GPU/CPU [RTX 5090, M3pr, Intel I9-9900k] (N/A if no GPU/CPU)
  • GPU-driver version (N/A if no GPU)
  • CUDA / CUDA-toolkit version (N/A if non-Nvidia)

Release version or Commit ID

v0.3.5

Additional Context

No response

BugDigK avatar Oct 27 '25 09:10 BugDigK