Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

How to Add an Additional Light Source in the Rasterizer?

Open sangminkim-99 opened this issue 10 months ago • 0 comments
trafficstars

Hi there,

First of all, thank you for creating and maintaining this amazing project—it's been a joy to explore!

I have a question about adding an additional light source to the rasterizer. After exploring the code and pyrender, I found a way to do this, but it feels a bit hacky and not ideal. Here's the approach I came up with:

scene.visualizer.renderer._context.add_light(
    {
        "type": "point",
        # "dir": [0, 0, -1],
        "pos": [0, 0.0, 3.0],
        "color": [1.0, 1.0, 1.0],
        "intensity": 10.0,
    }
)

To make this work, the add_light method needs to be called after scene.build().

I hope this information might help others trying to achieve something similar.

That said, I'd love to know if there's a cleaner or officially supported way to add light sources to the scene. If anyone has suggestions or alternative approaches, please share them—I’d greatly appreciate it!

Thanks in advance, and keep up the great work!

sangminkim-99 avatar Jan 08 '25 14:01 sangminkim-99