mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 226 forks source link

Rendering light #258

Open dheeraj-BN opened 1 year ago

dheeraj-BN commented 1 year ago

can someone help me how to redender light in a mesh

bulb_mesh = trimesh.creation.uv_sphere(radius=bulb_radius, count=[bulb_resolution, bulb_resolution]) bulb_mesh.apply_translation([bulb_position_x, bulb_position_y, bulb_position_z])

light_color = [0.0, 1.0, 0.0] light_intensity = 1000.0 bulb_mesh_node = pyrender.Node(mesh=pyrender.Mesh.from_trimesh(bulb_mesh),light=pyrender.light.DirectionalLight(color=light_color, intensity=light_intensity))

scene.add_node(bulb_mesh_node)

use pointlight and help me with a solution

dheeraj-BN commented 1 year ago

i have used it like this as well but not helping

scene.add_node(bulb_mesh_node)

light_color = [0.0, 1.0, 0.0] # Blue light light_intensity = 1000.0 # Candela light_node = pyrender.Node(light=pyrender.light.DirectionalLight(color=light_color, intensity=light_intensity)) light_position = [0.5, 0.5, 0.5] # Example position light_node.matrix = np.eye(4) light_node.matrix[:3, 3] = light_position

scene.add_node(light_node,parent_node=bulb_mesh_node)

Add the light node to the scene

scene.add_node(light_node)

peekxc commented 1 year ago

Can confirm that changing the parameters of the any light added to a scene does effectively nothing to a scene