Lighting

From Wolfire Games Wiki
Revision as of 07:59, 18 March 2018 by Merlyn (talk | contribs) (Shaping the dynamic light: formatting, and cross-reference)
Jump to: navigation, search

This article is a stub. You should help Wolfire by expanding it.

TODO: Better formatting

Sunlight

The sun allows you to cast dynamic, single-directional light throughout a level.
You can use it to simulate either a sun (more direct light) or a moon (more ambient light)

Double click the sun in the sky to select it.
Double click well outside of the sun editor to deselect it (the normal Q for "deselect all" isn't working right now)

Move the sun by clicking on the middle of it and dragging it around the sky.
Change the sun color by dragging the dot around the outer ring.
Change the sun intensity by clicking just outside the outer ring and drag it.

If you have problems clicking it, or would prefer a numeric editor, simply hit hit Y to open the scenegraph.
Expand "level" to find the Sun parameters.


Point lights

Point lights allow you to cast omni-directional light from a point in the level.

Adding a dynamic light:

  • Top Bar -> Load -> Lighting -> Dynamic Light
  • The cursor will turn into a plus symbol
  • Click in level to place the dynamic light

Changing the size of a dynamic light

  • Select the light (double click)
  • Hold E while clicking and dragging on its bounding box.

Note that this only changes the light's area of influence, not how much light it outputs.
If you want to make the light cover a larger area you'll have to both make its area of influence larger, and also increase its brightness using its overbright slider.

Adjusting dynamic light color:

  • Select the light
  • Hit CTRL + P (command + P on mac) to open the Color Picker.

Adjust the color with the color selector, or RGB at the bottom.
The "overbright" slider increases the brightness of the light.

Shaping the dynamic light

Dynamic lights are always spherical right now. If you need an "area light" effect that isn't a sphere, there are a few options:

  • Use Shadow Decals to shape the light (you have to enable this in the level first. See this section below)
  • Place multiple dynamic light objects
  • Some combination of both of the above

Be careful to both look at how the lights affect static objects in the scene, and how they affect characters that walk through them.


Shadow decals

Shadows from sunlight are taken care of automatically.
However this only allows one level of shadowing. This doesn't handle ambient occlusion (shadowing of indirect light reflections).

Shadow decals ("Ambient Shadows") allow you to manually place decals which simulate this ambient occlusion effect.
This can help you visually anchor objects more realistically in the scene, and replicate effects like darkening around corners, and inside cubbyholes.


Ambient Shadow Decals's effect on light


Adding a shadow decal:

  • Top Bar -> Load -> Lighting -> Ambient Shadow.
  • The cursor will turn into a plus symbol.
  • Now click in level to place the ambient shadow decal.

Resizing a shadow decal:

Double click the ambient shadow decal, and hold E while clicking and dragging on its bounding box (or while shift + right-clicking and dragging on a side to only stretch in that direction).
This will let you increase the spread of its effect.

Note: Ambient shadow decals will not create shadows if they in direct light. This is because they're for simulating indirect shadowing. Direct shadowing is already handled by placing objects in the world.


Dynamic lights and shadows

By default, no objects cast shadows from dynamic point lights (besides the sun). This is for performance reasons.

Normally ambient shadow decals also will not create shadow from dynamic point lights, because that would be shading direct light, and they don't work that way.

However you can use the #SHADOW_POINT_LIGHTS level Custom Shader to make it so shadow decals can shape point lights, so you can manually simulate this shadowing.


without #SHADOW_POINT_LIGHTS #SHADOW_POINT_LIGHTS Custom Shader setting with #SHADOW_POINT_LIGHTS


Making shadow decals affect dynamic lights:

  • Hit Y to open the level's scenegraph
  • Expand Script Params
  • Add a Custom Shader param
  • Hit Enter (not tab!)
  • Type #SHADOW_POINT_LIGHTS in the value column and hit enter

This will make ambient shadows affect the direct light from dynamic lights, an let you sculpt the light they cast, or let you create manual shadows.