Select Page

Basic URP lighting tutorial Unity 2020

Step 1: Set up the Scene Create a new project in Unity and switch the rendering mode to Universal Render Pipeline (URP) in the Project Settings. This will allow you to use the URP features for lighting and rendering.

Next, create a new scene by going to File > New Scene or by pressing Ctrl + N (Windows) or Cmd + N (Mac). In the Hierarchy window, add a Cube GameObject and a Plane GameObject to the scene. Position the Cube above the Plane and adjust the scale if needed.

Step 2: Set up Lighting To add lighting to the scene, go to the Hierarchy window, right-click, and select Light > Directional Light. This will create a new directional light in the scene.

Position the light so that it is shining on the Cube from an angle. You can adjust the rotation of the light by clicking and dragging the rotation handles in the Scene view.

Adjust the intensity and color of the light to your liking by selecting the Directional Light GameObject in the Hierarchy window, and then adjusting the settings in the Inspector window.

Step 3: Adjust Shadow Settings To enable shadows in the scene, select the Directional Light GameObject in the Hierarchy window, and then go to the Inspector window.

Click on the little arrow next to the Light component to expand the settings. Under Shadows, enable the Cast Shadows checkbox. This will enable the light to cast shadows.

Adjust the other shadow settings to your liking, such as the shadow resolution and strength. You can also adjust the softness of the shadows by adjusting the value of the Softness property.

Step 4: Set up Materials To set up materials for the Cube and the Plane, select the Cube in the Hierarchy window, and then go to the Inspector window.

Click on the Add Component button and select Mesh Renderer. This will add a Mesh Renderer component to the Cube.

Next, click on the Materials dropdown and select Create > Material. Name the material “Cube Material” and adjust the color and other settings to your liking. You can adjust the Albedo color to change the color of the material.

Repeat the same steps for the Plane GameObject, by adding a Mesh Renderer component and creating a new material. Name the material “Plane Material” and adjust the color and other settings to your liking.

Step 5: Set up Shadow Receiver To allow the Plane to receive shadows, select the Plane in the Hierarchy window, and then add a Mesh Renderer component to it.

Next, click on the Materials dropdown and select Create > Material. Name the material “Plane Material” and adjust the color and other settings to your liking. This will allow the Plane to have a material that can receive shadows.

Step 6: Adjust Project Settings To ensure that the shadows are visible in the scene, go to the Edit menu and select Project Settings > Quality.

Under the Shadows section, make sure that the Shadow Distance is set to a value that includes the entire scene. This will ensure that all objects in the scene can cast and receive shadows.

Step 7: Test the Scene To test the scene, press the Play button in the Unity Editor. You should see the Cube casting a shadow on the Plane. Adjust the lighting and materials as needed to get the desired effect.

Congratulations! You have successfully created a basic scene with lighting and shadows using Unity 2020 URP.

Powered by BetterDocs