Learn how to write a basic shader
- 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
- Modelling experience is very useful to understand textures, UV Maps, normals, vertices etc.
- ShaderLab
- Cg
- Basic lighting techniques
- Beginner: 2 days
- Expert: 1 hour
- Import a model into the scene (or use the sphere)
- Create a new shader based on the unlit shader
- Add a material with this shader to your model and see it render
- Modify the shader to have an "Albedo" input
- Multiply the albedo by the texture result to make it a "tint" to the texture
- Add Lambert[1] shading to give it a diffuse look
- Add Phong[1] to give us a shiny look (include a shininess/roughness parameter)
- Convert to BlinnPhong[1] and try to get similar looking results to Phong (performance optimisation)
- Add a fresnel[2,3] effect to the model to approximate the phenomenon where light reflects more at shallow angles
- Extend the shader to use a texture for shininess/roughness instead of a number
- Add support for a normal map, instead of relying on the mesh's normals
- [1] Lighting models in Unity: https://www.jordanstevenstechart.com/lighting-models (don't just copy paste!)
- [2] Fresnel (in a surface shader) - https://www.ronja-tutorials.com/2018/05/26/fresnel.html
- [3] Fresnel again: http://kylehalladay.com/blog/tutorial/2014/02/18/Fresnel-Shaders-From-The-Ground-Up.html
- [4] John Carmack (iD Software) blowing your mind about lighting. Very good video. Principles of Lighting and Rendering with John Carmack at QuakeCon 2013
- [5] Steve's implementation of some or all of these: https://github.com/xwipeoutx/unity-bits
Principles of Lighting and Rendering with John Carmack at QuakeCon 2013