Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Keystone to Great Lighting
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#1
The Keystone to Great Lighting

Light.
What would the world be without it? Besides "dark", obviously.

The point is, light is a big deal when it comes to real life, AND all forms of entertainment. So why would you slack on it? Surprisingly, lighting can make one area either scary, peaceful, serene, or even funny. Light is the key to making a campaign 100% complete. And sadly, more than a few campaigns don't grasp the concept of light, so much, that I'm here to help you out on it. This is NOT a tutorial, I am merely showing you the effects of taking care on lighting an area JUST right and hopefully inspire you to get creative. Don't be afraid to experiment!

~Comparison screenshots can be found at the end of the article.~

First off... Let's go over the types of lights given in the HPL2..

BoxLights
Boxlights consume every angle and crevice of an area in light and will end abruptly at the boxlight's edges. It is HIGHLY suggested that you try to keep the boxlight dark, even when covering an exterior area in mid-daylight. This will set a base for shadows when you make a large spotlight, otherwise, shadows will produce a pitch-black silhouette that will make the player lose his sanity... It's daylight out, a shadow shouldn't make him cripple (excluding Sciophobia).
A boxlight that is too bright will also look unnatural. I see this mistake being put into way too many campaigns as a shortcut to putting pointlights. Don't get lazy! Trust me, it will be worth the effort in the end!
I almost never use boxlights, but when I do, it covers an area with a light with settings as:
R: 0.1
G: 0.1
B: 0.1
A: 1
Side-Tip: The player loses sanity in dark colors under 0.15... If you would like the player NOT to lose anity, but don't want the room to be lighter, you will have to script: SetSanityDrainDisabled(bool abX);
Which makes it hardly visible. Again, a base for shadows. Colors can be SLIGHTLY altered for matching environment light. For example, a Boxlight at night would have the same settings but blue would be set to something like 0.14, giving an EVER-SO-SLIGHT hue to it. This trick was used in "Oh Silent Night".
Remember, boxlights are more for setting a BASE lighting, otherwise the game will run in pitch-darkness. Blackness such as that should ONLY be used in areas with absolutely NO source of light. Imagine boxlights as the color for all your shadows.
Now, let's move to the next one...
Pointlights
Pointlights are the step up from boxlights, setting standards for lighting. They produce light at a center point and spread out in all directions, consuming most edges and areas in light, but not ALL like its Grandfather, boxlights. But this doesn't mean this is the best you can do! I personally, use pointlights around spotlights to make the light fade smoother, this trick was also used in "Oh Silent Night" for spotlights around candles and the fireplace. It CAN be used on candles to make the light range larger, but I suggest only using it in areas with no objects around it. Such as an empty hallway.
These sources are great, but again, not the BEST for complete immersion. It can actually make a place look worse than being completely dark. Use it wisely!
Let's meet the best-man of light.
Spotlights
Spotlights are the best sources of light, in my opinion. I use these more than the other two sources of light, as they can be increased in range AND field of view. A great trait! The biggest reason I love these is because they cast shadows in real-time and can turn a mood from poor to great. Everything in the world produces a shadow when a source of light is present, so this is why I refrain from pointlights as much as necessary.
"But Statyk! Spotlights don't spread out in all directions like pointlights, having these on a candle would look terrible!"
Not exactly my friend! To fix this, increase the field of view of the spotlight and duplicate it, keeping it in the same position, but simply rotating it so it fits alongside the other spotlights. Duplicate and repeat! This trick was used in almost every candle in "Oh Silent Night" as well as the Theater Room in "Sciophobia".
So remember, don't be afraid to experiment! Spotlights as well as correct lighting are your keystone to CS-making. Without it, the campaign will fall!
_________________________________________________________________
Let's get to some examples through "Oh Silent Night"...
[Image: lighting1_by_statyk94-d4khsd7.jpg]
This is in comparison from pointlights to spotlights. I actually have the spotlights flicker a VERY small change in color to represent candle flicker. As well as moonlight spotlights to fade the candle light and show how light bleeds through.
[Image: lighting2_by_statyk94-d4khsek.jpg]
Another comparison between point and spotlights.
[Image: lighting3_by_statyk94-d4khsgl.jpg]
Another comparison.
[Image: lighting4_by_statyk94-d4khshu.jpg]
The kitchen was my favorite scene in Oh Silent Night. The kitchen island and counters are actually made of primitives, and primitives don't like to cast shadows, even when spotlights say so. To fix this, I actually hid a black technical plane inside of the island countertop, giving the shadow you see below it. Go above and beyond!
__________________________________________________

(cont'd)


In Sciophobia:
[Image: lighting5_by_statyk94-d4khsji.jpg]
The last one got cut off, it just showed the amount of arrays. =\ But this is the theater boxroom in Sciophobia. See how spotlights give subtle, but BIG differences, like the banner and sofas?
__________________________________________
Errors and bugs of lighting:
[Image: lighting6_by_statyk94-d4khsno.jpg]
Here, you can see the pointlights in the kitchen from the demonstration above bleed through the walls and into the bathroom. This is a common issue that sometimes seems unavoidable! But not if you have Spotlights!
[Image: lighting7_by_statyk94-d4khspn.jpg]
In Oh Silent Night, the floors and ceilings were made with primitives. Which, described earlier, do not produce shadows, even when "cast shadows" is selected. So when using spotlights, the light still bled through the ceiling, into the 2nd floor. It was an ugly sight. Placing a large Technical Black Plane (static_objects) in between the floor of the second floor and the ceiling of the first cleaned it all up instantly. You get can an image/understanding by saying the mouse is where the kitchen island is and I flipped the viewpoint of the editor upside-down, so I am looking through the floor, to the ceiling. Again, think outside of the box!
__________________________________________________________
[Image: lighting8_by_statyk94-d4khsr1.jpg]
Lastly, here's an outside environment with a sunset. A boxlight surrounds the entire area in the color shown in the dark side of the trees. The bright color is actually the VERY large spotlight up at the top of the shot. It's size is actually so large, the shadows of the trees dropped quality BIGTIME... Unfortunately. But I think it still looks decent.

So what to take from this?
- Boxlights are helpful, but DO NOT USE THEM FOR SOURCES OF LIGHT.
- Pointlights are best for smoothing out lights or in areas with no objects around, such as an empty hallway.
- Spotlights are your best friend. They cast shadows and can make a room go from a laugh, to horrifying.
- Don't be afraid to tweak the rules and place technical black planes to block light from bleeding into nasty areas.
[/align]
(This post was last modified: 12-28-2011, 08:04 PM by Statyk.)
12-28-2011, 08:04 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: The Keystone to Great Lighting

I wonder how all the extra shadows would affect performance.

Tutorials: From Noob to Pro
12-28-2011, 08:38 PM
Website Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#3
RE: The Keystone to Great Lighting

(12-28-2011, 08:38 PM)Your Computer Wrote: I wonder how all the extra shadows would affect performance.
It's up to the player to determine which has shadows and which do not. For example, spotlights pointing at walls from candles should not, as no shadows would be casted anyway. Of course, with a very large map, it is not recommended to put it on every lightsource. But Oh Silent Night was a small area. I suggest only keeping it in places where there are many objects in one place, or where the player will be for an extended amount of time. In the kitchen, they will be circling around, looking for a key, but in the 2nd floor hallway, the lights at the "intersection" are actually pointlights. No spotlights where there, as no objects around and the player simply walks past it.

This is to give people an idea on how to blend light into areas properly. I see many campaigns with unmatched lighting and it makes me sad =[ It's up to the creator to wield the sword correctly.
12-28-2011, 09:00 PM
Find
Mine Turtle Offline
Senior Member

Posts: 647
Threads: 32
Joined: Mar 2011
Reputation: 29
#4
RE: The Keystone to Great Lighting

now i know who to ask if i need a light x) you have serious skill! ^^
12-28-2011, 10:04 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#5
RE: The Keystone to Great Lighting

If you carve your keystone full of emblems and markings to make it look good, it will make it weak and the whole structure might collapse.

I tested Oh Silent Night's fps on my computer. (The version without the heavy particle effects).
With all the spot lights my fps was about 20-50
When I removed every spot light the fps increased to 50-80

That is pretty big improvement in performance.
Everyone should agree that frictional knows their engine inside and out and know how to optimize a map. I will gather here some important parts from this extremely great tutorial on wiki, because many seems to not acknowledge its existence or skim through it so fast they miss the important parts.

Jens tells the secrets of lighting:
"The most common and general purpose light is the Point light, while the Spot and Box are lights for more specific purpose"
"The different types of lights make it crucial to use a combination of them to create the right type of light design for your level"
"Rotate lamp entities to see how the point light is placed on it inside model editor (its not straight on top of the entity)"
"Each room has one light that casts a shadow. What light it should be is chosen by what gives the biggest impact on the room or what would create the nicest effect"
"Spot Lights can use a much smaller radius if you place them more efficiently, they do not need to be at the exact correct location. It will not be very noticeable if the light location is not at the window, rather a few meters in and closer to the ground"
"Avoid having too many shadow casting lights, in particular try to make sure that two or more shadow casting lights do not cross each other, that really slows down"
"When having two or more shadow casting lights close to each other (ingame they will be visible at the same time) lower the shadow quality of the lights"
"When using a shadow casting light you can turn of shadows on objects that do not need it. For example the floor, ceiling, walls with no other room behind it, carpets, paper, books in a shelf etc. Everything that is in contact with the light but that does not really cast a visible shadow or a very noticeable shadow. To turn off shadows you select the object and uncheck CastShadows. For entities this is under the Entity tab and for Static it is under the Static Object tab"
"A trick when dealing with many shadow casting lights that are close to each other. Turn off all shadows and alpha for the lights and then create an additional light, that casts a shadow and has alpha, make it as large as the area the other lights cover. Then by placing the new light at a good position, you can create the impression of all other lights casting shadows even though it is only the new light that casts the shadow"

Many don't seem to know what alpha value in lights mean or just ignore it completely. Try placing a point light in level editor, setting it to flicker from 0 alpha to 1, then rotate around it to see the effect.
Having alpha value slows the game down!
The lower the overall value of the light, the less visual intensity the alpha value has. You should use alpha value only for lights that have clear visual benefit from it.

Box light has no benefit from alpha value! I'm not sure yet if alpha value in box light slows the game, because tutorial says it does, but some of TDD's maps have 1 and some 0. Don't be lazy though and just use the half a second it takes to change it to 0 just in case.

When it comes to lamps light leaking through walls, clever placement is the most important thing.
Spoiler below!
[Image: leaktrick.jpg]From 10_daniels_room

Dim point lights are your friends!
I am merely showing you how to optimize lighting. Don't be afraid to experiment!

12-30-2011, 01:16 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#6
RE: The Keystone to Great Lighting

(12-30-2011, 01:16 AM)Khyrpa Wrote: If you carve your keystone full of emblems and markings to make it look good, it will make it weak and the whole structure might collapse.

I tested Oh Silent Night's fps on my computer. (The version without the heavy particle effects).
With all the spot lights my fps was about 20-50
When I removed every spot light the fps increased to 50-80

That is pretty big improvement in performance.
Everyone should agree that frictional knows their engine inside and out and know how to optimize a map. I will gather here some important parts from this extremely great tutorial on wiki, because many seems to not acknowledge its existence or skim through it so fast they miss the important parts.

Jens tells the secrets of lighting:
"The most common and general purpose light is the Point light, while the Spot and Box are lights for more specific purpose"
"The different types of lights make it crucial to use a combination of them to create the right type of light design for your level"
"Rotate lamp entities to see how the point light is placed on it inside model editor (its not straight on top of the entity)"
"Each room has one light that casts a shadow. What light it should be is chosen by what gives the biggest impact on the room or what would create the nicest effect"
"Spot Lights can use a much smaller radius if you place them more efficiently, they do not need to be at the exact correct location. It will not be very noticeable if the light location is not at the window, rather a few meters in and closer to the ground"
"Avoid having too many shadow casting lights, in particular try to make sure that two or more shadow casting lights do not cross each other, that really slows down"
"When having two or more shadow casting lights close to each other (ingame they will be visible at the same time) lower the shadow quality of the lights"
"When using a shadow casting light you can turn of shadows on objects that do not need it. For example the floor, ceiling, walls with no other room behind it, carpets, paper, books in a shelf etc. Everything that is in contact with the light but that does not really cast a visible shadow or a very noticeable shadow. To turn off shadows you select the object and uncheck CastShadows. For entities this is under the Entity tab and for Static it is under the Static Object tab"
"A trick when dealing with many shadow casting lights that are close to each other. Turn off all shadows and alpha for the lights and then create an additional light, that casts a shadow and has alpha, make it as large as the area the other lights cover. Then by placing the new light at a good position, you can create the impression of all other lights casting shadows even though it is only the new light that casts the shadow"

Many don't seem to know what alpha value in lights mean or just ignore it completely. Try placing a point light in level editor, setting it to flicker from 0 alpha to 1, then rotate around it to see the effect.
Having alpha value slows the game down!
The lower the overall value of the light, the less visual intensity the alpha value has. You should use alpha value only for lights that have clear visual benefit from it.

Box light has no benefit from alpha value! I'm not sure yet if alpha value in box light slows the game, because tutorial says it does, but some of TDD's maps have 1 and some 0. Don't be lazy though and just use the half a second it takes to change it to 0 just in case.

When it comes to lamps light leaking through walls, clever placement is the most important thing.
Spoiler below!
[Image: leaktrick.jpg]From 10_daniels_room

Dim point lights are your friends!
I am merely showing you how to optimize lighting. Don't be afraid to experiment!
For you:
[Image: trollface.jpg]


Lol thanks Khyrpa, that's news to me as well.
12-30-2011, 02:15 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#7
RE: The Keystone to Great Lighting

One way I avoid the performance drop from having a lot of shadowcasters clustered together is avoiding placing lights in spots that would require it to cast so many shadows! For example, that screenshot with the candle on the 2 small tables and the 2 couches next to it? I would just remove one of the couches and move the other slightly farther away, as well as adjusting the small square table appropriately.

01-02-2012, 08:36 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#8
RE: The Keystone to Great Lighting

(01-02-2012, 08:36 PM)palistov Wrote: One way I avoid the performance drop from having a lot of shadowcasters clustered together is avoiding placing lights in spots that would require it to cast so many shadows! For example, that screenshot with the candle on the 2 small tables and the 2 couches next to it? I would just remove one of the couches and move the other slightly farther away, as well as adjusting the small square table appropriately.
or just set one light facing 90 degrees to one couch, another 90 degrees to the other, and another 45 to the table and leave the rest to a pointlight. =P This way they don't touch/cross each other.
(This post was last modified: 01-02-2012, 09:17 PM by Statyk.)
01-02-2012, 09:17 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#9
RE: The Keystone to Great Lighting

(01-02-2012, 09:17 PM)Statyk Wrote: or just set one light facing 90 degrees to one couch, another 90 degrees to the other, and another 45 to the table and leave the rest to a pointlight. =P This way they don't touch/cross each other.
And then at least turn down the shadow resolution of the spot lights!

01-03-2012, 06:43 AM
Find
Kman Offline
Posting Freak

Posts: 4,187
Threads: 25
Joined: Jul 2011
Reputation: 219
#10
RE: The Keystone to Great Lighting

I've actually seen quite a few people have trouble with shadow quality when they make large spotlights for sunlight.I haven't tried it myself,but a solution to that might be to just duplicate a semi-large spotlight a bunch so you have many individual spotlights closer up, which might solve the problem. I don't know though,it's just a theory, haven't actually tested it out.

Posting Freak
01-03-2012, 08:52 AM
Website Find




Users browsing this thread: 1 Guest(s)