Difference between revisions of "Lighting"

From Wolfire Games Wiki
Jump to: navigation, search
(Add youtube tutorial video covering various lighting topics)
m (Shadow decals: formatting)
Line 39: Line 39:
 
<br clear=all>
 
<br clear=all>
 
== Shadow decals ==
 
== Shadow decals ==
{{#ev:youtube|https://www.youtube.com/watch?v=wOL0LJBRcas||right|||start=15}}
 
 
Shadows from sunlight are taken care of automatically.<br>
 
Shadows from sunlight are taken care of automatically.<br>
However this only allows one level of shadowing.<br>
+
However this only allows one level of shadowing. This doesn't handle ambient occlusion (shadowing of indirect light reflections).
This doesn't handle ambient occlusion (shadowing of indirect light reflections).<br>
 
  
 
Shadow [[Custom Decals|decals]] ("Ambient Shadows") allow you to manually place decals which simulate this ambient occlusion effect.<br>
 
Shadow [[Custom Decals|decals]] ("Ambient Shadows") allow you to manually place decals which simulate this ambient occlusion effect.<br>
 
This can help you visually anchor objects more realistically in the scene, and replicate effects like darkening around corners, and inside cubbyholes.
 
This can help you visually anchor objects more realistically in the scene, and replicate effects like darkening around corners, and inside cubbyholes.
  
''Top Bar -> Load -> Lighting -> Ambient Shadow''.<br>
+
<br clear=all>
The cursor will turn into a plus symbol.<br>
+
{{#ev:youtube|https://www.youtube.com/watch?v=wOL0LJBRcas||right|||start=15}}
Now click in level to place the ambient shadow decal.
+
[[File:Ambient shadow decals.png|600px|Ambient Shadow Decals's effect on light]]
 +
 
 +
<br clear=all>
 +
==== Adding a shadow decal: ====
 +
 
 +
* ''Top Bar -> Load -> Lighting -> Ambient Shadow''.<br>
 +
* The cursor will turn into a plus symbol.<br>
 +
* 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).<br>
 
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).<br>
 
This will let you increase the spread of its effect.
 
This will let you increase the spread of its effect.
  
'''Note''': Ambient shadow decals will not create shadows if they in direct light.<br>
+
'''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.
This is because they're for simulating indirect shadowing.<br>
 
Direct shadowing is already handled by placing objects in the world.
 
  
 
<br clear=all>
 
<br clear=all>
[[File:Ambient shadow decals.png|600px|right|Ambient Shadow Decals's effect on light]]
+
== Shadow decals and dynamic lights ==
 
 
<br clear=all>
 
=== Affect on dynamic lights ===
 
  
 
By default, no objects cast shadows from dynamic point lights. This is for performance reasons.
 
By default, no objects cast shadows from dynamic point lights. This is for performance reasons.
Line 70: Line 72:
 
However you can use the <code>'''#SHADOW_POINT_LIGHTS'''</code> level Custom Shader to make it so shadow decals can shape point lights, so you can manually simulate this shadowing.
 
However you can use the <code>'''#SHADOW_POINT_LIGHTS'''</code> level Custom Shader to make it so shadow decals can shape point lights, so you can manually simulate this shadowing.
  
Hit <kbd>'''Y'''</kbd> to open the level's scenegraph, expand Script Params, and add a <code>'''Custom Shader'''</code> param, and hit Enter. Then type <code>'''#SHADOW_POINT_LIGHTS'''</code> 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.
+
<br clear=all>
 
 
 
[[File:Shadow point lights shader disabled.png|400px|without #SHADOW_POINT_LIGHTS]]
 
[[File:Shadow point lights shader disabled.png|400px|without #SHADOW_POINT_LIGHTS]]
 
[[File:Shadow_point_lights_shader.png|400px|#SHADOW_POINT_LIGHTS Custom Shader setting]]
 
[[File:Shadow_point_lights_shader.png|400px|#SHADOW_POINT_LIGHTS Custom Shader setting]]
 
[[File:Shadow_point_lights_shader_enabled.png|400px|with #SHADOW_POINT_LIGHTS]]
 
[[File:Shadow_point_lights_shader_enabled.png|400px|with #SHADOW_POINT_LIGHTS]]
 +
 +
<br clear=all>
 +
==== Making shadow decals affect dynamic lights: ====
 +
 +
* Hit <kbd>'''Y'''</kbd> to open the level's scenegraph
 +
* Expand Script Params
 +
* Add a <code>'''Custom Shader'''</code> param
 +
* Hit <code>Enter</code> (not <code>tab</code>!)
 +
* Type <code>'''#SHADOW_POINT_LIGHTS'''</code> 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.
  
 
[[Category: Tutorials]]
 
[[Category: Tutorials]]
 
[[Category: Modding]]
 
[[Category: Modding]]
 
[[Category: Overgrowth]]
 
[[Category: Overgrowth]]

Revision as of 07:50, 18 March 2018

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.

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

To change the light's area of influence, double click it and 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.
So 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.

To change the color of the light, select it and hit CTRL + P 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.

If you need an "area light" (non-spherical) effect, you can either use shadow decals to shape the light, or you can place multiple dynamic light objects, or some combination of both.
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.


Shadow decals and dynamic lights

By default, no objects cast shadows from dynamic point lights. 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.