Lights#
Lights illuminate a rendered scene. How you add them depends on the backend:
Rasterizer (and the viewer): lights come from the
lightslist ongs.options.VisOptions, using the light classes ings.options.vis. With no configuration the scene gets a single directional light, so it is lit out of the box. Set ambient fill separately throughVisOptions.ambient_light.RayTracer: there are no light objects. A light is an entity with an
Emissionsurface, plus the optionalSphereLightarea lights below.BatchRenderer: lights are added at runtime with
scene.add_light(...); see BatchRenderer.
For usage and worked examples, see Rendering.
Rasterizer lights#
These classes populate the lights list on gs.options.VisOptions and light the rasterizer and the viewer.
gs.options.vis.DirectionalLight#
A light with parallel rays and no position, like the sun. The scene’s default light is one of these.
gs.options.vis.PointLight#
A light that emits from a point in space, falling off with distance.
gs.options.vis.AmbientLight#
A uniform fill light with no direction, applied everywhere so shadows are not pure black.
SphereLight#
A spherical area light for the RayTracer renderer. Pass one or more in gs.renderers.RayTracer(lights=[...]) to illuminate a scene, controlling position, color, intensity, and radius. Color values are not restricted to [0, 1], so they can express HDR intensities.
- class genesis.options.renderers.SphereLight(*, pos: tuple[float, float, float] = (0.0, 0.0, 10.0), color: tuple[float, float, float] = (1.0, 1.0, 1.0), intensity: float = 1.0, radius: float = 4.0) None[source]#
Sphere light for the ray tracer.
- Parameters:
pos (tuple of float) – Position of the light. Defaults to (0.0, 0.0, 10.0).
color (tuple of float) – Color of the light. Values are not restricted to [0, 1] to allow HDR lighting.
intensity (float) – Intensity multiplier for the light color. Defaults to 1.0.
radius (float) – Radius of the light sphere. Defaults to 4.0.