0% found this document useful (0 votes)
4 views6 pages

ARVR Ex3

The document outlines two exercises in Unity: downloading objects from the asset store and applying lighting and shading effects, and implementing dynamic lighting controlled by button presses. The first exercise involves importing 3D models, adding various light sources, and applying shaders, while the second focuses on creating a scene with lights that can be toggled using keyboard inputs. Both exercises were executed successfully, demonstrating the application of lighting and shading techniques in Unity.

Uploaded by

kavya0002u
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

ARVR Ex3

The document outlines two exercises in Unity: downloading objects from the asset store and applying lighting and shading effects, and implementing dynamic lighting controlled by button presses. The first exercise involves importing 3D models, adding various light sources, and applying shaders, while the second focuses on creating a scene with lights that can be toggled using keyboard inputs. Both exercises were executed successfully, demonstrating the application of lighting and shading techniques in Unity.

Uploaded by

kavya0002u
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Kavya V

953622104048

Ex. No. : 03 A DOWNLOAD OBJECTS FROM THE ASSET STORE AND


APPLY LIGHTING AND SHADING EFFECTS
Date:

AIM:
To Download objects from the asset store and apply lighting and shading effects.

PROCEDURE:

✅ Step 1: Open Unity & Import Objects

 Open Unity Asset Store (Window → Asset Store).


 Search for "Free 3D Models" (e.g., Trees, Cars, Houses).
 Click Download → Import to bring them into the project.

✅ Step 2: Add Lighting Sources

 Directional Light: Simulates sunlight (Default in scene).


 Point Light: Emits light in all directions (like a bulb).
 Spot Light: Focused beam (like a flashlight).
 Go to GameObject → Light → Choose Light Type.
 Adjust Position, Intensity, Color, and Range from Inspector.

✅ Step 3: Apply Shading Effects

 Select an object → Inspector → Mesh Renderer → Material.


 Click Shader → Choose Shader Type:
o Standard Shader (PBR): Supports Metallic, Smoothness, Normal Maps.
o Unlit Shader: No lighting, just color.
o Custom Shader: Advanced effects using Shader Graph.

✅ Step 4: Test in Play Mode

 Rotate lights, change shadow properties, and test different shaders.


Kavya V
953622104048

OUTPUT:

RESULT:
Thus Download objects from the asset store and apply lighting and shading effects
was executed successfully.
Kavya V
953622104048

Ex. No. : 03 B DYNAMIC LIGHTING WITH BUTTON PRESS

Date:

AIM:
To Dynamic Lighting with Button Press.

PROCEDURE:

Step 1: Create the Scene


1. Open Unity → New Scene (or use an existing one).
2. Remove the default Directional Light (to start in complete darkness).
3. Create a 3D Cube → (GameObject → 3D Object → Cube).
4. Position the cube at (0,1,0) to make it visible in front of the camera.

Step 2: Add Different Light Sources


1. Create three different lights:
o Directional Light → (Simulates sunlight).
o Point Light → (Glows in all directions like a bulb).
o Spot Light → (Focuses like a flashlight).
2. Disable all lights initially in the Inspector (Uncheck the "Enabled" box).

Step 3: Add a C# Script for Button Interaction


1. Right-click in Assets → Create → C# Script → Name it "LightController".
2. Attach this script to the Main Camera.
3. Open the script and paste the following code:

using UnityEngine;

public class LightController : MonoBehaviour


{
public Light directionalLight;
public Light pointLight;
public Light spotLight;

void Start()
{
// Disable all lights at the start
directionalLight.enabled = false;
pointLight.enabled = false;
spotLight.enabled = false;
}

void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha1)) // Press '1' for Directional Light
{
Kavya V
953622104048
directionalLight.enabled = !directionalLight.enabled;
}
if (Input.GetKeyDown(KeyCode.Alpha2)) // Press '2' for Point Light
{
pointLight.enabled = !pointLight.enabled;
}
if (Input.GetKeyDown(KeyCode.Alpha3)) // Press '3' for Spot Light
{
spotLight.enabled = !spotLight.enabled;
}
}
}

Step 4: Assign Lights in Unity


1. Select Main Camera.
2. Drag Directional Light, Point Light, and Spot Light into the LightController
script fields in the Inspector.

Step 5: Run & Test the Scene


 Press Play in Unity.
 Press ‘1’ → Directional Light turns on/off.
 Press ‘2’ → Point Light turns on/off.
 Press ‘3’ → Spot Light turns on/off.
Kavya V
953622104048
OUTPUT:
Kavya V
953622104048

RESULT:
Thus Dynamic Lighting with Button Press was executed successfully.

PERFORMANCE(25)

VIVA VOCE(10)

RECORD(15)

TOTAL(50)

You might also like