Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.3 KB

shader-lighting.md

File metadata and controls

53 lines (36 loc) · 2.3 KB

Shaders and Lighting

⧀ back

Learn how to write a basic shader

Scene overview

  • Create a few models and materials with various basic lighting effects
  • Note this will not touch on PBR, environment maps, reflections - it's a basic LIGHTING model, not IBL or PBR model

Prerequisites

  • Modelling experience is very useful to understand textures, UV Maps, normals, vertices etc.

Knowledge Gained

  • ShaderLab
  • Cg
  • Basic lighting techniques

Expected time to complete

  • Beginner: 2 days
  • Expert: 1 hour

Simple guide

  1. Import a model into the scene (or use the sphere)
  2. Create a new shader based on the unlit shader
  3. Add a material with this shader to your model and see it render
  4. Modify the shader to have an "Albedo" input
  5. Multiply the albedo by the texture result to make it a "tint" to the texture
  6. Add Lambert[1] shading to give it a diffuse look
  7. Add Phong[1] to give us a shiny look (include a shininess/roughness parameter)
  8. Convert to BlinnPhong[1] and try to get similar looking results to Phong (performance optimisation)
  9. Add a fresnel[2,3] effect to the model to approximate the phenomenon where light reflects more at shallow angles
  10. Extend the shader to use a texture for shininess/roughness instead of a number
  11. Add support for a normal  map, instead of relying on the mesh's normals

Useful Resources to complete

Videos

Principles of Lighting and Rendering with John Carmack at QuakeCon 2013

Principles of Lighting and Rendering with John Carmack at QuakeCon 2013