-
Notifications
You must be signed in to change notification settings - Fork 134
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:
light.set_position(Vec3 position)
light.set_position(float x, float y, float z)
light.set_color(Vec3 color)
light.set_color(float r, float g, float b)
light.set_ies_profile(int ies_profile)
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).
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: