Unity 2D Scene Tutorial - Layers, lighting, post-processing, blur camera etc

Philip Paul
28 Feb 202319:44

Summary

TLDRThis video provides an in-depth devlog on building a game scene using the Universal Render Pipeline (URP). The creator walks through the process of layer management, lighting, and post-processing, offering practical tips for organizing assets, adding depth with lighting techniques, and creating effects like fog and blurred backgrounds. The video emphasizes the importance of maintaining control over each element, adjusting blur levels, and using post-processing tools to achieve a cinematic look. It's a helpful guide for solo developers looking to enhance their game scenes with visual effects and organization.

Takeaways

  • 🎮 The video is a devlog explaining how the creator built their simulation game with details like layer management, lighting, and post-processing.
  • 🛠️ The developer mentions that creating games as a solo dev is overwhelming, as they have to manage everything from story, scripting, and design to technical aspects.
  • 💡 The first step was to set up a scene in Unity using the Universal Render Pipeline (URP), warning that transitioning to URP might break materials but is fixable.
  • 📂 The developer organizes assets into three folders: foreground, mid-ground, and background, while adding multiple sorting layers for proper sprite management.
  • 🎨 Blurred assets were used in the scene for depth, with closer objects having less blur and distant objects more, offering control over the depth effect.
  • 🌟 Global lighting was created for different layers to manage the brightness and darkness of the scene, with special attention to foreground, mid-ground, and background lighting.
  • 🔦 Shape lights and spotlights were utilized for more control over specific scene elements, enhancing the platforms and creating mood with colors.
  • 🌫️ Fog sprites were added for depth and atmosphere, created in Photoshop and imported into Unity, with color and transparency adjustments.
  • ✨ Sprite lights were applied to specific layers for additional lighting effects, requiring proper layer management to avoid conflicts with other elements.
  • 📸 The developer used multiple cameras with different post-processing effects to blur the background, stacking them in Unity to achieve the desired sharpness and blur in specific scene layers.

Q & A

  • What is the main purpose of the video?

    -The video aims to provide a detailed devlog on how the creator built a simulation game, covering aspects like layer management, lighting, and post-processing, among others.

  • Why does the creator emphasize the need for a detailed devlog?

    -The creator explains that as a solo developer, they have to manage many areas of the game development process, making it easy to forget certain details after moving on to other tasks. The devlog serves as a reference for future work.

  • What is the first step in setting up a new scene in Unity using the URP pipeline?

    -The first step is creating a new scene in Unity using the Universal Render Pipeline (URP) or converting an existing scene to URP, though this process might cause material issues that need to be fixed.

  • How does the creator manage layers and assets in the scene?

    -The creator organizes the scene by creating three folders: foreground, mid-ground, and background. They also add sorting layers to manage how sprites are displayed relative to one another, assigning each sprite to its appropriate layer.

  • What technique does the creator use to add depth to the scene?

    -The creator adds depth by blurring certain assets in Photoshop, with objects closer to the player having less blur and distant objects having more. They also use semi-transparent planes for additional layers.

  • How does the creator handle lighting in different layers of the scene?

    -The creator uses multiple global lights, each affecting different layers like the foreground, mid-ground, and background. They start by making layers dark and then gradually adjust brightness using tools like shape lights and spotlights.

  • What is the purpose of using Sprite lights and how are they created?

    -Sprite lights are used to add localized lighting effects. The creator makes them by painting white dots on a transparent background in Photoshop, blurring them, and exporting them as PNG files to be used in Unity.

  • How does the creator add fog effects to the scene?

    -Fog effects are created by designing blurred white dots in Photoshop and importing them into Unity. The fog sprites' transparency is adjusted, and they are placed in the scene to add atmospheric depth.

  • What method does the creator use to blur the background of the scene?

    -The background blur is achieved by duplicating the main camera and setting up one sharp camera and one blurred camera. Separate layers are assigned for background blur, and depth of field effects are applied only to the blurred camera.

  • What final touch does the creator add to improve the visual quality of the scene?

    -The creator adds post-processing effects like Bloom, color curves, and Lift Gamma Gain to enhance the scene's lighting and colors, creating a more cinematic feel while being careful not to overdo the effects.

Outlines

00:00

📽️ Introduction to the Devlog and Scene Setup

The video starts by introducing the content as a devlog requested by viewers, focusing on the development process of building a simulation. The creator highlights the complexity of game development as a solo developer, covering aspects like auto direction, game design, and coding. They emphasize the challenge of retaining knowledge as projects evolve and explain that this video will walk through the process of creating a new scene using the URP pipeline in Unity. The tutorial begins by adjusting sprite rendering settings, organizing assets into foreground, mid-ground, and background layers, and assigning sorting layers to each sprite for clarity.

05:38

💡 Enhancing Scene Depth with Lighting

This section focuses on adding depth to the scene by adjusting background opacity layers and global lighting effects. The creator discusses setting up multiple global lights for various scene layers, using the first light for the foreground with zero intensity and the second for the mid-ground. They also describe techniques for controlling the lighting of specific platforms in the game using shape lights and spotlighting the background to create a fantasy-like atmosphere. The section concludes with advice on choosing color schemes to avoid cluttering the game’s aesthetic.

10:39

🌫️ Adding Fog and Depth to the Scene

To add atmospheric depth, the creator introduces fog sprites, explaining how they are created in Photoshop with blurred white dots. These sprites are imported into Unity and used to enhance the sense of distance in the background. The creator also adds sprite lights, generated similarly to the fog sprites, and applies them selectively to specific layers. After some troubleshooting with fog panels affecting lighting, they suggest organizing these into dedicated layers for better visual control. More sprite lights are added to enhance the scene’s ambiance.

15:42

🌅 Applying Sprite Shape Lighting and Post-Processing Effects

This section discusses refining the lighting by ensuring sprite shapes are aligned on the same Z axis as the relevant assets to prevent parallax issues. Sunrays are created using volumetric lighting techniques, and more assets like grass and rocks are added to fill out the scene. The video then transitions to post-processing, where the creator introduces global volume settings to apply effects such as Bloom, color curves, and lift gamma gray. After experimenting with different post-processing effects, they caution viewers not to overuse these tools to avoid overwhelming the scene.

📷 Blurring the Background with Dual Camera Setup

In the final section, the creator demonstrates how to blur the background using a two-camera setup. By duplicating the main camera, they create a 'sharp' camera for foreground elements and a 'blur' camera for the background. Both cameras are assigned specific rendering layers, and post-processing is applied to the blurred camera only. After troubleshooting issues with global lighting affecting the background blur, the lights are reassigned to the correct layer. The section ends with fine-tuning the blur effect to achieve the desired result, adding the final touch to the scene.

Mindmap

Keywords

💡URP Pipeline

URP (Universal Render Pipeline) is a scriptable render pipeline in Unity that allows developers to optimize graphics and performance for various platforms. In the video, the developer transitions their scene to URP to improve rendering, though this process can cause issues with materials, as mentioned in the script.

💡Sorting Layers

Sorting layers in Unity are used to determine the rendering order of 2D sprites, ensuring that specific elements appear in front of or behind others. In the video, the developer creates multiple sorting layers (foreground, mid-ground, background) to better manage sprite display and create depth in the scene.

💡Global Lights

Global lights refer to lighting that affects the entire scene or specific layers in Unity. In the script, the developer explains how they create several global lights for different layers (foreground, mid-ground, background) to control the overall lighting of the game environment.

💡Sprite Lights

Sprite lights are a lighting feature in Unity that allows developers to illuminate specific 2D sprites or objects. The video shows the creator adding sprite lights to various assets like trees to enhance the atmosphere, while managing their effect using sorting layers.

💡Post Processing

Post processing involves adding visual effects to a game scene after rendering, such as bloom, depth of field, and color correction. The video discusses how the developer applies post-processing effects like bloom and lift gamma gain to enhance the cinematic quality of their scene.

💡Depth of Field

Depth of field (DoF) is a post-processing effect that simulates the blurring of distant objects, helping create visual focus on certain elements in a scene. The developer uses a depth of field effect in the video to blur the background, adding depth and emphasizing objects in the midground.

💡Volumetric Lighting

Volumetric lighting is a technique that adds visible beams of light in a 3D scene, often used to simulate sunlight filtering through fog or dust. The developer applies this technique to sun rays in the game, enhancing the visual mood and atmosphere.

💡Fog Sprites

Fog sprites are 2D images used to simulate fog or mist in a game scene. In the video, the developer creates fog sprites by blurring white dots in Photoshop and placing them in the Unity scene to add depth and atmosphere to the background layers.

💡Camera Stacking

Camera stacking is a technique in Unity where multiple cameras render different parts of a scene. The video explains how the developer uses this to achieve a blurred background effect by duplicating the main camera and adjusting the rendering layers and post-processing effects for each.

💡Bloom Effect

Bloom is a post-processing effect that simulates the glow of bright lights, often used to give a more dynamic and luminous look to a scene. In the video, the developer mentions adding bloom, though cautiously, as too much bloom can make the scene look overly bright or washed out.

Highlights

Introduction to the devlog explaining how the video will cover a more detailed breakdown of the simulation creation process.

Emphasizing the importance of documentation for solo developers to avoid forgetting key aspects of development over time.

Creating a new scene using the Universal Render Pipeline (URP) and warning about potential material issues during conversion.

Fixing sprite overlay issues by adjusting the rendering axes and implementing custom sorting layers for proper sprite organization.

Organizing the scene into foreground, mid-ground, and background layers to enhance visual depth and manage asset sorting.

Using blurred assets to create a sense of depth, applying more blur to distant objects and less to closer ones for visual distinction.

Demonstrating the use of multiple global lights to control the lighting for different scene layers, including foreground, mid-ground, and background.

Introducing the shape light tool for lighting specific scene elements, such as platforms where the player will interact.

Enhancing background visuals with spotlights and playing with color to create a fantasy or mysterious mood.

Adding fog sprites to the scene for atmospheric depth by creating blurred white dots in Photoshop and adjusting their transparency in Unity.

Introducing sprite lights for dynamic scene lighting and discussing issues with overlapping fog panels and sorting layers.

Using parallax effects to create depth in the scene and ensuring that sprite shapes align with the correct Z-axis for proper rendering.

Creating post-processing effects, such as Bloom and Lift Gamma Gain, to add cinematic depth and mood to the scene.

Demonstrating how to blur the background by duplicating cameras, applying post-processing effects, and separating camera layers for blurred and sharp elements.

Final step: Managing the global lights and blur layer interactions to properly display the Skybox and adjust the desired blur level for the background.

Transcripts

play00:00

hi guys this video was a requested one

play00:02

there were quite a few people who were

play00:04

interested in seeing a more detailed

play00:06

devlog on how exactly I built my sim you

play00:08

know layer management lighting post

play00:10

processing etc etc so I thought this

play00:14

could be a great opportunity to make one

play00:16

and hopefully you'll get to learn

play00:18

something along the way aside from that

play00:20

this devlog I think could be useful even

play00:23

for future me as a solo developer you

play00:25

must cover almost every area of the game

play00:28

from Auto Direction scene building to

play00:30

game Design Story Lord effect script

play00:32

code and so many other things oh my God

play00:35

I'm just getting a panic attack just

play00:37

thinking about all this but anyway the

play00:39

point is well it's very easy to forget

play00:42

stuff you've been working on for a while

play00:44

especially after you move down to

play00:46

something else so here we go let's start

play00:49

from the beginning first we'll make a

play00:51

new scene using the urp pipeline if your

play00:53

scene is not already in urp watch this

play00:56

video on how to convert it but be

play00:58

prepared just to have a nervous

play00:59

breakdown since the urp transition is

play01:02

going to ruin many of your materials but

play01:05

fortunately you can fix that it just

play01:07

takes some time okay so let's drag a few

play01:10

assets into our scene the very thing

play01:12

you'll notice is the fact these Sprites

play01:14

don't really overlay much with each

play01:16

other especially in the Z position so

play01:18

let's fix that search for a rendered 2D

play01:21

this comes automatically with a urp

play01:23

Pipeline and we are going to change from

play01:25

default to custom axes then set 0 value

play01:28

to y axis and 1 to Z and voila Magic

play01:36

now we should organize things a bit so

play01:38

let's make three folders foreground

play01:40

mid-ground and background the next thing

play01:43

we most absolutely do is add sorting

play01:45

layers I'm thinking to add around the 6

play01:47

maybe but if needed I can definitely add

play01:50

more so each sprite from the scene will

play01:52

go into the assigned layer the platform

play01:54

the player will walk on will remain on

play01:56

default while Sprites closer to that

play01:59

will go in the Middle Ground section

play02:03

[Music]

play02:09

foreign

play02:12

foreign

play02:21

[Music]

play02:30

objects to the scene by the way you can

play02:32

select multiple Sprites at once and sort

play02:34

them rather than each individually for

play02:37

the purpose of this video I'm thinking

play02:39

nothing to fancy rather a simple scene

play02:41

with some platforms the player might

play02:43

jump on

play02:52

foreign

play03:05

Sprites are a bit blurry that's because

play03:08

well I simply blur them in Photoshop as

play03:11

you can see I have a special folder for

play03:13

the Blurred assets things that are

play03:14

closer to the player will have less blur

play03:17

while things in the distance will have

play03:19

more that's at least one way to do it

play03:21

maybe is not the most effective one but

play03:24

at least gives me a certain level of

play03:26

control having multiple levels of blur

play03:30

another way would be to use multiple

play03:32

cameras and then blur the backgrounds

play03:34

with that I will show you towards the

play03:36

end how to do that as well anyway as you

play03:38

can see the scene seems to have more and

play03:40

more assets and layers now in the

play03:42

background as well in the foreground

play04:07

[Music]

play04:17

thank you

play04:41

[Music]

play04:42

foreign

play05:38

thank you

play05:44

[Music]

play05:50

[Music]

play05:53

foreign

play05:54

[Music]

play06:00

[Music]

play06:17

[Music]

play06:37

I also added a few simple planes with

play06:39

reduced opacity on almost each

play06:42

background layer this is pretty great if

play06:44

you want your scene to have more depth

play06:51

[Music]

play06:57

[Music]

play07:05

foreign

play07:10

[Music]

play07:21

that being said let's take care of the

play07:23

lighting the very first thing that I've

play07:26

made was to create a few Global lights

play07:27

that would have an effect on certain

play07:29

layers I made one for the foreground

play07:31

with reduce the value to zero and I made

play07:34

another one except this one won't be

play07:37

zero something a bit closer it's all up

play07:40

to you how dark you want the second

play07:41

layer of your foreground to be now let's

play07:44

make another Global light except this

play07:46

one will be for the mid ground and

play07:48

lastly one for the background actually

play07:50

let's make two the idea is to make

play07:53

things dark first and then bring them to

play07:55

light using various tools

play08:00

foreign

play08:10

[Music]

play08:22

thank you

play08:24

okay so the first thing we are going to

play08:26

use is the shape light which is pretty

play08:28

great since allows me to have more

play08:30

control over the things I want to be lit

play08:32

I primarily use this for the platforms

play08:34

where the player is going to step on

play08:36

ignoring pretty much everything else

play08:39

[Music]

play08:51

thank you

play08:53

[Music]

play08:59

[Music]

play09:08

[Music]

play09:19

foreign

play09:21

[Music]

play09:31

[Music]

play09:32

foreign

play09:35

[Music]

play10:08

[Music]

play10:12

foreign

play10:15

[Music]

play10:19

for the backgrounds I'm going to use

play10:21

various spotlights that will highlight

play10:23

parts of the world I can also play with

play10:25

color in order to create a more

play10:27

mysterious and fantasy mood I highly

play10:29

recommend watching this video which

play10:31

explains very well how to use color and

play10:33

what works with what so you don't end up

play10:36

just throwing random colors in your game

play10:38

managing this can be pretty challenging

play10:40

overall and I did see plenty of games

play10:42

from AAA to Indie mess this up

play10:45

[Music]

play10:49

foreign

play10:51

[Music]

play11:54

foreign

play11:57

[Music]

play12:03

foreign

play12:07

[Music]

play12:19

[Music]

play12:23

next I'm thinking to add more depth to

play12:26

the scene by creating some Fox Sprites

play12:28

these are pretty easy to make just some

play12:31

white dots blurred in Photoshop and

play12:33

exported as pngs then I can simply bring

play12:36

them into Unity change color reduce

play12:38

transparency and that's it

play12:44

foreign

play12:47

[Music]

play13:11

[Music]

play13:16

foreign

play13:23

[Music]

play13:37

[Music]

play13:57

[Music]

play14:17

okay now let's add some Sprite lights

play14:20

just as before they are pretty simple to

play14:23

make then I grabbed and dropped one of

play14:25

the textures I made to make this you

play14:27

follow pretty much the same procedure as

play14:29

before go into Photoshop paint a few

play14:31

white dots over a transparent background

play14:33

blur them and then export it as PNG now

play14:36

I don't want the Sprite lights to have

play14:38

an effect over everything so I'm going

play14:41

to assign only the layer I wanted to be

play14:43

affected and oh okay so the reason this

play14:47

doesn't work as intended is because of

play14:49

those large fog panels we added in the

play14:51

beginning which are on the same sorting

play14:53

layer as soon as I disable those Sprites

play14:55

bam we see the lights falling only over

play14:58

the trees however I do want my fog as

play15:01

well you know have my kicking knitting

play15:03

tool so let's make another layer that is

play15:05

special only for the fog panel as I said

play15:07

we can add multiple layer later if we

play15:10

must okay now let's add multiple Sprite

play15:12

lights to the scene

play15:14

[Music]

play15:21

foreign

play15:36

[Music]

play15:41

by the way one quick tip the Sprite

play15:44

shapes must have the same Z position as

play15:46

the assets you want to assign it on

play15:49

otherwise The Parallax effect will

play15:51

display it on a different speed you see

play15:54

something like this we want to avoid for

play15:56

the sun rays we can apply the same

play15:58

technique except we'll turn on the

play16:00

volumetric option from this point onward

play16:02

you can spend as much time as you want

play16:04

adding more assets to the scene so it's

play16:06

Fuller grass rocks bushes whatever you

play16:09

want now let's take care of the cherry

play16:11

on the top which is post processing to

play16:13

do that we must create a global volume

play16:15

with a new profile then click override

play16:18

and then select whatever effect you want

play16:25

foreign first I would like to add some

play16:27

Bloom but just a bit since it can burn

play16:29

up my scene very quickly oh it doesn't

play16:32

work okay so I think I might know why I

play16:35

simply forgot to check the cross

play16:37

processing option from the main camera

play16:39

then I added some color curves and

play16:41

pretend that like I knew what I was

play16:43

doing yeah I would not bother much with

play16:45

that anyway the next effect is pretty

play16:47

great lift gamma gray this can easily

play16:50

turn up your scene into something a bit

play16:52

more cinematic just play around a bit

play16:54

with these three wheels and see what

play16:56

fits your scene okay so after a while

play16:58

these are the effects I ended up with at

play17:00

the end of the day it's a lot of mix and

play17:02

match and see whatever works for you but

play17:05

the idea end result is an improvement

play17:06

however be careful not to go too

play17:09

overboard with this effect now the last

play17:11

thing I want to show you is the Blurred

play17:13

background so the very first thing we

play17:15

need to do is duplicate the main camera

play17:17

make two copy of that Ctrl D is the

play17:20

shortcut for that by the way so the

play17:22

first camera we are going to name

play17:23

something like a camera Sharp and the

play17:26

second one which will contain the blur

play17:28

effect while Camera blur simple as that

play17:30

then select both cameras and make them

play17:33

child of the main camera

play17:35

okay so next let's make another cross

play17:37

processing volume this one will only

play17:40

contain the depth on Field Effect and

play17:42

that's it by the way don't forget to

play17:44

make a new profile for this post

play17:45

processing effect as well okay so the

play17:48

next step is very important we need to

play17:50

create a separate layer for the Blurred

play17:52

camera click add layer and name it

play17:54

whatever you want in this case blurred

play17:56

background or something like this but in

play17:58

your case you can type it actually

play18:00

correctly anyway so the Blurred camera

play18:02

will go on this separate layer so

play18:04

instead of default choose background

play18:06

blur okay we need to set up these two

play18:08

cameras select both of them go to render

play18:11

type and change from base to Overlay

play18:13

then let's choose first camera sharp in

play18:15

the cooling mask and volume mask section

play18:18

we need to deselect the background blur

play18:20

layer now on the other hand on the

play18:22

Camera blur in the same sections we'll

play18:25

do exactly the same except will only

play18:27

make visible the background blur layer

play18:29

everything else will be deselected next

play18:32

the post processing effect must be

play18:34

placed on the same layer here as well as

play18:36

the folder which contains all the assets

play18:38

for the background next we need to go in

play18:40

the main camera in the stack section

play18:42

here we need to add those two cameras we

play18:45

just created by simply pressing the plus

play18:47

button now the order of this really

play18:50

matters the one above is going to be in

play18:52

the background and the one below in the

play18:54

foreground it's like the inverse version

play18:57

of Photoshop layers

play18:59

so as you can see the mid section has no

play19:01

blur while the background is completely

play19:03

blurred which is pretty much what we

play19:06

really wanted except we still have one

play19:08

problem we don't really see the Skybox

play19:10

at all and that's because the global

play19:13

lights we created in the beginning well

play19:15

they are on the wrong layer so we'll

play19:17

select both of them and choose

play19:18

background blur layer and bam bam thank

play19:21

you ma'am here's how you blur the

play19:22

background next you can choose the type

play19:24

and amount of blurry wand but that's

play19:27

kind of it hopefully you've learned

play19:29

something from this video but if you

play19:31

have any questions please let me know in

play19:33

the comment section and I will do my

play19:35

best to respond in time so bye bye see

play19:38

you next time

play19:39

[Music]

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Game DevelopmentUnity URPLayer ManagementLighting EffectsPost ProcessingAsset HandlingIndie DeveloperScene BuildingGame DesignSolo Development
Benötigen Sie eine Zusammenfassung auf Englisch?