-
Notifications
You must be signed in to change notification settings - Fork 133
Lights
To create a light, you have to import the light classes. You can do this by doing from RenderPipeline import SpotLight
or if you are in the same directory: from __init__ import SpotLight
.
After doing that, you should create an instance of your light and set the desired properties (see below):
from RenderPipeline import PointLight
my_light = PointLight()
# set desired properties, see below
self.render_pipeline.add_light(my_light)
There are several light types in the Pipeline. All lights share some properties, which you can modify with the property interface:
Shared Light Properties:
-----
light.position
light.color
light.ies_profile
light.casts_shadows
light.shadow_map_resolution
light.near_plane
The light position specifies the lights position in world space. (TODO: Add support for lights attached to node paths).
The light color controls the appearance of the light. A value of (1.0, 1.0, 1.0)
means plain white. Notice you can use colors way over 1.0, for example (7.0,6.0,6.5)
.
See [IES Profiles](IES Profiles).
To enable shadows on the light, use set_casts_shadows(True)
. You can control the resolution of the shadow map with set_shadow_map_resolution(int resolution)
.
To avoid artifacts from objects which are very close to the light, you can set the near plane with set_near_plane(float near_plane)
. This behaves like on a regular camera lens.
This is a radial light positioned at a point. Point Lights have an additional radius and inner radius property, which can be set with:
point_light.set_radius(float radius)
point_light.set_inner_radius(float inner_radius)
The radius controls the maximum distance in world space, which the light affects. The inner radius controls the size of the light, for point lights this is 0.0, but if you want to have area spherical lights, set this to a value greater than zero.
This is a light with a direction and angle, behaving like a camera, or a flashlight. The radius controls the maximum distance after which the influence of the light gets zero. The direction is the forward vector of the light. The FoV just behaves like the FoV on a camera. You can set the properties with:
spot_light.set_radius(float radius)
spot_light.set_fov(40)
spot_light.set_direction(float dx, float dy, float dz)
spot_light.set_direction(Vec3 direction)
# Helper functions for setting the direction:
spot_light.look_at(Vec3 position)
spot_light.look_at(float x, float y, float z)
More light types will follow
Rendering Pipeline by tobspr (c) 2014 - 2016
For developers: