Light3D - A light that is an EngineObject3D, so it can move, follow a parent or be destroyed like anything else
- A point light: it lights what is near it and fades out by its radius, DirectionalLight3D shines from far away
- A coneAngle makes it a spotlight: it shines along its own forward, turned by rotation3D or by what it is
attached to, inside the cone, fading over the part of it coneSoftness says
- The sun, render3D.sunDirection, casts the shadows; a spotlight can cast them in its place, see
render3D.shadowLight; the other lights light and make highlights without one
- Only the 8 lights nearest the camera are used each frame
- radius is where the light fades out, and it fades fast, so a small radius wants a higher intensity
- intensity multiplies the color, above 1 for a light brighter than white
- radius is a world distance, so scale3D does not change it
- An alpha, an intensity or a radius of 0 switches it off, and a light that is off takes none of those slots
- Draws nothing but its glow, when it has one; add a small emissive mesh if the lamp itself should be seen
- addFlare gives it a lens flare, see LensFlare3D
pos3D Vector3 optionalWhere it is
radius number optional, default 5Distance where the light fades to nothing
color Color optionalLight color, its alpha fades it
intensity number optional, default 1Brightness, multiplies the color, above 1 is brighter than white
const torch = new Light3D(vec3(0, 3, 0), 10, hsl(.1, 1, .65));
torch.addFlare(); // light in the lens when the torch is in view
Makes it a spotlight: the angle in radians from its forward out to the edge of its
cone, so the beam is twice this across; 0 for a light that shines every way
How much of the cone is its fading edge: 0 a hard edge, .2 by default, the outer
fifth, 1 fading all the way from the middle of the beam
Shine from far away, from its position toward the origin, instead of out from its
position with a falloff; DirectionalLight3D sets it
The light's lens flare, undefined for none: addFlare makes it, or set a LensFlare3D of your own, and
destroying the flare takes it away
- The flare is the light's: it is attached to the light as its child, so it stays through a scene change
when the light does, and is destroyed with the light or when another takes its place
A gel: a picture the light shines through, like a stained glass
window or the leaves of a tree, cast along its cone in its colors, upright as the light looks out, the whole
texture of a TileInfo; only the spotlight that casts the shadows has one, with render3D.shadows on and it
as render3D.shadowLight, and only on what takes its shadows: an object with receiveShadow off is lit
without the gel; its alpha is not read, see through panes are dark
Size of a soft hazy glow drawn over the light, like a lamp at night, 0 for none; it
is added onto what is behind it, and what is in front of the light hides it
How fast the glow fades from its middle: 1 by default, .5 a wide haze, 2 a tight
bright core
Brightness, multiplies the color, above 1 is brighter than white
Distance where the light fades to nothing
Give the light a lens flare, made with the arguments of LensFlare3D, in place of the one it had
size number optionalScales every part of it
count number optionalHow many ghosts there are, besides the glow at the light
intensity number optionalHow bright it is
saturation number optionalHow colorful the ghosts are
color Color optionalTints the flare, with the light's own color
- Returns
- The flare, to change: light.addFlare().shapes = ['hex']
Destroy the light, and its flare with it
immediate boolean optional
Draw the glow, a quad facing the camera with a soft round glow on it, pulled toward the camera by half its
size so a lamp at the light does not cut into it, but never past the camera