-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Lighting and GI
The lighting model in Chop Chop is pretty simple, and it relies a lot on the shaders to deliver its look. In short, we bake GI using Subtractive mode mixed lighting and then we process lightmaps with the shader, while realtime objects receive light from Light Probes.
As pictured in the image above, static objects get their shadows baked and approximated by the shader. These shadows are flat and never become fully black. Dynamic objects instead (like the Plant Critter pictured) cast a very dark shadow on static objects (the ground in this case), but not on static objects lit by light probes (like the little rock, pictured).
The scene setup is extremely simple: we have just one directional light representing the sun and set to Mixed mode. This light has intensity 1 and colour #FFF4D6 (for full day scenes), and is set to provide Soft Shadows.
All big pieces of environment geometry are set to static (Contribute GI), while all small objects (like grass, pebbles, flowers) are set to static but the Receive Global Illumination property is set to Light Probes on their MeshRenderer components.
Ambient lighting is provided using a gradient: #B1BFD4 (Sky) #23353F (Equator) #1E241E (Ground).
The skybox is a Cubemap skybox material, using custom painted cubemap textures, found in /Art/Skybox/Painted
.
For baking GI, we use Mixed lighting mode set to Subtractive. Realtime shadow colour doesn't matter, since it's forced to a different colour in the shader.
When we bake lightmaps, much of the nuance of the lightmaps is actually lost because of the toon shader approximating gradients. For this reason, many baking parameters like the number of samples or the lightmap resolution don't make much of a difference.
Since from Unity 2020.3 LTS lighting settings are stored in a file, you can use the ones coming from a file called "Locations', which is found in /Settings/LightBakingSettings/
. Please don't modify the values of this file, as it is used to bake all Locations in the game. If you want to make quick tests or have to bake non-final scenes, such as whiteboxing, use the file "LowResBakes" in the same folder.
If you want to create your own settings, the most important parameters are the ones as follows:
- We bake Ambient Occlusion and sometimes with Direct Contribution set to 2, to make it stand out a bit more.
- Lightmap resolution is set to very low values, like 10 or even 5 in some big scenes. When making test bakes, we go down to 2.
- Directional mode is set to Non-Directional because we don't need that extra set of maps, given that we don't use a PBR workflow.
For night scenes (currently only a test, found at /Scenes/WIP/NightGround.unity
) decrease the intensity of the main light to .1 before baking. Once baking is complete, bring it back to 1, so it lights dynamic objects correctly.
Unity Open Projects - Open-source games made by Unity + the community
We are looking forward to see what you will create ❤
- the Unity Creator Advocacy team
- Game architecture overview
- Playing the game in Unity
- Creating a new playable scene
- Building the game
The game systems explained, with API examples. For programmers.
- Event system
- State machine
- Input
- Object pooling
- Runtime anchors
- Audio system
- Narrative
- Dialogue system
- Cutscenes system
- Inventory and Cooking
- Combat
- User Interface
How-tos for designers to expand the game's gameplay.
- Adding quests
- Adding items
- Creating dialogues
- Making a cutscene