0
0
Unityframework~10 mins

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

Choose your learning style9 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.