Bird
Raised Fist0
Unityframework~10 mins

Unlit vs lit shaders in Unity - Visual Side-by-Side Comparison

Choose your learning style10 modes available
Concept Flow - Unlit vs lit shaders
Start: Object Render
↓
Choose Shader Type
↓
Unlit Shader
↓
No Lighting
↓
Apply Color
↓
Display Object on Screen
When rendering an object, the system chooses between unlit or lit shaders. Unlit shaders skip lighting calculations and show color directly. Lit shaders calculate lighting before showing the final color.
Execution Sample
Unity
Shader "Custom/UnlitColor" {
  SubShader {
    Pass {
      Lighting Off
      Material {
        Diffuse (1,0,0,1)
      }
    }
  }
}

// Lit shader calculates lighting before color
This example shows a simple unlit shader that colors an object red without lighting effects.
Execution Table
StepShader TypeLighting CalculationColor AppliedOutput
1UnlitSkippedRed (1,0,0,1)Object appears solid red, no shading
2LitCalculated based on lights and normalsRed modulated by lightObject appears red with shading and highlights
3UnlitSkippedBlue (0,0,1,1)Object appears solid blue, flat color
4LitCalculatedBlue modulated by lightObject appears blue with shading
5End--Rendering complete
💡 Rendering ends after applying shader color with or without lighting
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Shader TypeNoneUnlitLitUnlitLitNone
Lighting CalculationNoneSkippedCalculatedSkippedCalculatedNone
Color AppliedNoneRedRed with lightBlueBlue with lightNone
OutputNoneSolid RedShaded RedSolid BlueShaded BlueRendered Object
Key Moments - 3 Insights
Why does the unlit shader show no shading or highlights?
Because unlit shaders skip lighting calculations as shown in execution_table rows 1 and 3, they apply color directly without considering lights.
How does the lit shader change the object's appearance?
Lit shaders calculate lighting based on scene lights and surface normals (rows 2 and 4), which modulates the base color to add shading and highlights.
Can unlit shaders respond to scene lighting?
No, unlit shaders ignore lighting calculations entirely (rows 1 and 3), so they always show flat colors regardless of lights.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the lighting calculation result at step 3?
ACalculated based on lights
BPartial calculation
CSkipped
DUnknown
💡 Hint
Check the 'Lighting Calculation' column at step 3 in the execution_table
At which step does the object first show shading and highlights?
AStep 2
BStep 1
CStep 3
DStep 5
💡 Hint
Look for 'Calculated' lighting and 'Shaded' output in execution_table
If we change the unlit shader color to green, which execution_table row would change?
ARow 4
BRow 1
CRow 2
DRow 5
💡 Hint
Unlit shader color is shown in row 1 under 'Color Applied'
Concept Snapshot
Unlit shaders skip lighting and show flat colors.
Lit shaders calculate lighting for shading and highlights.
Unlit is simpler and faster but less realistic.
Lit shaders respond to scene lights and normals.
Choose unlit for flat style, lit for realism.
Full Transcript
This visual trace compares unlit and lit shaders in Unity. When rendering an object, the system picks a shader type. Unlit shaders skip lighting calculations and apply color directly, so objects appear flat and solid colored. Lit shaders calculate lighting using scene lights and surface normals, which modulates the base color to add shading and highlights. The execution table shows steps where unlit shaders skip lighting and apply color directly, while lit shaders calculate lighting before applying color. Variables like shader type, lighting calculation, and output color change step by step. Key moments clarify why unlit shaders show no shading and how lit shaders add realism. The quiz tests understanding of lighting calculation steps and color application. The snapshot summarizes that unlit shaders are simpler and faster but less realistic, while lit shaders respond to lights for realistic effects.

Practice

(1/5)
1. What is the main difference between Unlit and Lit shaders in Unity?
easy
A. Unlit shaders do not react to lighting, Lit shaders do
B. Unlit shaders are slower than Lit shaders
C. Lit shaders ignore shadows, Unlit shaders show shadows
D. Lit shaders only work on 2D objects

Solution

  1. Step 1: Understand Unlit shader behavior

    Unlit shaders display colors without any lighting or shadow effects.
  2. Step 2: Understand Lit shader behavior

    Lit shaders calculate lighting and shadows to create realistic visuals.
  3. Final Answer:

    Unlit shaders do not react to lighting, Lit shaders do -> Option A
  4. Quick Check:

    Lighting reaction = Unlit no, Lit yes [OK]
Hint: Unlit means no light effects, Lit means light and shadows [OK]
Common Mistakes:
  • Thinking Unlit shaders are slower
  • Believing Lit shaders ignore shadows
  • Assuming Lit shaders only work on 2D
2. Which of the following is the correct way to assign an Unlit shader to a material in Unity's Shader dropdown?
easy
A. Shaders > Unlit > Color
B. Shaders > Legacy Shaders > Transparent
C. Shaders > Standard
D. Shaders > Lit > PBR

Solution

  1. Step 1: Locate Unlit shaders in Unity

    Unlit shaders are found under the menu path: Shaders > Unlit > Color.
  2. Step 2: Confirm correct shader assignment

    Assigning 'Unlit > Color' applies an unlit shader that ignores lighting.
  3. Final Answer:

    Shaders > Unlit > Color -> Option A
  4. Quick Check:

    Unlit shader path = Shaders > Unlit > Color [OK]
Hint: Unlit shaders are under Shaders > Unlit in dropdown [OK]
Common Mistakes:
  • Choosing Standard shader which is lit
  • Selecting Legacy shaders unrelated to unlit
  • Picking Lit shaders for unlit materials
3. Given this Unity shader code snippet, what will be the visual result on a 3D object?
Shader "Custom/Example" {
  SubShader {
    Tags { "RenderType"="Opaque" }
    Pass {
      CGPROGRAM
      #pragma vertex vert
      #pragma fragment frag
      struct appdata { float4 vertex : POSITION; };
      struct v2f { float4 pos : SV_POSITION; };
      v2f vert(appdata v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); return o; }
      fixed4 frag(v2f i) : SV_Target { return fixed4(1,0,0,1); }
      ENDCG
    }
  }
}
medium
A. The object will flicker between colors
B. The object will be shaded with light and shadows
C. The object will be invisible
D. The object will appear bright red without lighting effects

Solution

  1. Step 1: Analyze the fragment shader output

    The fragment shader returns fixed4(1,0,0,1), which is solid red color.
  2. Step 2: Check for lighting calculations

    No lighting or normal calculations exist, so color is unlit and constant.
  3. Final Answer:

    The object will appear bright red without lighting effects -> Option D
  4. Quick Check:

    Fragment color fixed red, no lighting = unlit red [OK]
Hint: No lighting code means solid color output [OK]
Common Mistakes:
  • Assuming lighting affects color here
  • Thinking object is invisible without lighting
  • Expecting color changes or flickering
4. You wrote a Lit shader but the object appears completely black in your scene. What is the most likely cause?
medium
A. The object has no mesh assigned
B. The shader is missing normal vector calculations
C. The shader is set to Unlit accidentally
D. The camera is disabled

Solution

  1. Step 1: Understand Lit shader requirements

    Lit shaders need normal vectors to calculate lighting properly.
  2. Step 2: Identify missing normal vector effect

    If normals are missing or incorrect, lighting calculations fail, causing black appearance.
  3. Final Answer:

    The shader is missing normal vector calculations -> Option B
  4. Quick Check:

    Missing normals = no lighting = black object [OK]
Hint: Lit shaders need normals for lighting; missing normals cause black [OK]
Common Mistakes:
  • Blaming mesh or camera instead of shader code
  • Confusing Unlit shader with Lit shader issues
  • Ignoring normal vector importance
5. You want to optimize a mobile game by reducing lighting calculations but still want some color variation. Which shader approach is best?
hard
A. Use Unlit shaders with no color variation
B. Use fully Lit shaders with multiple lights
C. Use Unlit shaders with vertex colors for variation
D. Use Lit shaders but disable shadows

Solution

  1. Step 1: Consider performance needs

    Reducing lighting calculations improves performance on mobile devices.
  2. Step 2: Choose shader with color variation but no lighting

    Unlit shaders with vertex colors provide color changes without expensive lighting.
  3. Final Answer:

    Use Unlit shaders with vertex colors for variation -> Option C
  4. Quick Check:

    Unlit + vertex colors = color variation without lighting cost [OK]
Hint: Unlit + vertex colors = color without lighting cost [OK]
Common Mistakes:
  • Using full Lit shaders which are costly
  • Choosing Unlit with no color variation loses visual interest
  • Disabling shadows alone doesn't reduce lighting cost fully
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard