Lighting Tutorial - How to use Lighting
Viewers on this topic shall acquire a basic understanding of both the Explorer
and Properties
tab before reading.
This topic is directed to beginners, however can be viewed by those who just learn more about lighting overall.
Lighting properties, post processing effects, and useful plugins will be discussed in this thread.
Why should I use lighting?
Lighting is a vital aspect to your game. It makes your players feel comfortable in a safe-looking environment. Such as showcase games, they are very useful for the type of game you are going to create. Especially for modern builds, realistic sunrays, fog, and atmosphere can set the correct tone.
How does lighting affect the gameplay of players within my game?
Lighting can both positively and negatively affect the gameplay of your players. However, it mostly depends on what style your game is. For example, if you are creating a cartoony game, a cartoony sky would be the best option. Moreover, if you were to create a horror game, dark fog would also be a good option. While it is good to have lighting to sum up the finishing touches of your game, excessive amounts of different settings can negatively affect the performance of players on low-end devices.
Lighting Service
How to Index
The lighting service can be indexed by scripts in the following ways:
game.Lighting
game:GetService("Lighting") -- (Recommended Version)
It can also be viewied in the Explorer
tab below Players
.
Properties
This part is probably the most important part that will hugely affect your gameplay. Of course, this is your game, meaning you get to adjust what you would like. Here is a brief explanation of the more important lighting properties that should be altered when possible.
Ambient
The ambient properly generally changes the hue of your world overall (specifically indoor areas). If you’d like your indoor ambient to be a bit brighter, it is possible that you can use this property and change the color to white.
Other info:
Property of: Lighting
Value type: Color3
Resource: Lighting.Ambient
Brightness
This is a self explanatory property. This property at default is set to 2
. The greater the value, the brighter your world will be.
Other info:
Property of: Lighting
Value type: Float
Resource: Lighting.Brightness
GlobalShadows
This property will render shadows in more indoor areas, determined by the ambient property. You may set this to false
to remove these shadows.
Other info:
Property of: Lighting
Value type: Bool
Resource: Lighting.GlobalShadows
OutdoorAmbient
Similar to the Ambient
property, this property adjusts the ambient more primarily for outdoor areas, instead of indoor areas.
Other info:
Property of: Lighting
Value type: Color3
Resource: Lighting.OutdoorAmbient
ClockTime
The clock time property runs on a 24 hour clock, determining the position of the sun. For those who use 12 hour clocks, 24 & 0
would be midnight, and 12
would be noon. P.M times would be 12 + hour.
I personally recommend @Maximum_ADHD’s Celestial Body Dragger plugin for easily adjusting the position of the sun/moon.
Other info:
Property of: Lighting
Value type: Float
Resource: Lighting.ClockTime
TimeOfDay
This property generally shares the same purpose as clock time, but in the value type of a string. This property does not change unless it is changed by a script. Personally, I find no use in this and I’d recommend sticking to ClockTime
.
Other info:
Property of: Lighting
Value type: String
Resource: Lighting.TimeOfDay
FogColor
If you choose to have fog in your game, this property will adjust the hue of the fog similar to the Ambient
and OutdoorAmbient
functions.
Other info:
Property of: Lighting
Value type: Color3
Resource: Lighting.FogColor
FogEnd
If you’d like fog in your game, this property shall be adjusted. The default value for this property is 100000
. The greater this number is the farther the fog is away. If you are looking for mild fog in the background, I recommend setting it to 1000 - 2000
. Values lower than that will increase the amount of fog in-game.
Other info:
Property of: Lighting
Value type: Float
Resource: Lighting.FogEnd
–
I did not cover every single property in that service, mainly due to the fact of less importance. If you would like to learn more about those properties, please use another source to your advantage.
Post Processing Effects
Post processing effects are other effects available to use that are just like properties. The following post processing effects are available to be used:
- BloomEffect
- BlurEffect
- ColorCorrectionEffect
- DepthOfFieldEffect
- SunRaysEffect
Post processing effects usually only work while in the Lighting
service (therefore it is recommend keeping it there). Post processing effects will only work if the Enabled property in them is set to true. Properties in these effects can be adjusted for the best settings.
How do I add these effects into my game?
You can add these effects into your game by clicking on the circular + when you hover over the Lighting
service with your mouse.
Scroll down to Post Processing Effects and click on the one you would like to add.
It should look like this when completed. (It does not have to say “Bloom” like mine, but an effect should go in the service.)
Effects
BloomEffect
The bloom effect adds additional glow to bright objects (such as the neon material) and the sky. Properties like Intensity, Size, and Threshold can be toggled with. More information can be found here.
BlurEffect
The blur effect adds blur to your entire game. In the effect, there is a property called Size that will toggle the strength of the blur. The greater the number, the more blur. Some showcase games have their Blur Size at 1
or 2
to give that perfect feeling. More information can be found here.
ColorCorrectionEffect
The color correction effect is used to adjust multiple color properties at once, such as Contrast, TintColor, Brightness, and Saturation. It is possible for multiple color correction effects to be applied at once. More information can be found here.
DepthOfFieldEffect
The depth of field effect is meant to blur out parts of a game not in direct focus, such as terrain extremely far out. As always, properties can be adjusted within this effect to adjust it to your style. More information can be found here.
SunRaysEffect
My personal favorite, the sunrays effect. This effect adjusts your sun to give it graphic rays, that is highly recommended for realistic games. Properties are very easy to be adjusted on this effect. More information can be found here.
Those are all the individual effects that can be added to make your lighting even better! Multiple effects can be added at once.
Conclusion
Lighting is an extremely important aspect to a game. Tweaking your lighting properties and effects will definitely make a huge impact on the gameplay. I hope this tutorial helped you a bit on what you might have been confused on. If you have any further questions, please reply to this thread. Thank you, happy developing!