Exploring Shaders in Unity Greg Miranda Greg@CreateSoftGroup.com Exploring Shaders in Unity
Introduction Who am I? What is a shader? Why are shaders important?
Basic Rendering Pipeline Rasterization Blending Vertex Shader Pixel Shader (Fragment Shader) Frame Buffer
Advanced Rendering Pipeline Shader Model 5 – DirectX 11 Hull Shader Domain Shader Hardware Tesselator Shader Model 4 – DirectX 10 Geometry Shader Shader Model 3 – DirectX 9, OpenGL Vertex Shader Pixel Shader (Fragment Shader) Frame Buffer
Lighting Specular Diffuse
Lighting - Diffuse Assume that light is reflected uniformly in all directions Lambertian term Basic idea: The light energy is spread out over a large surface area when the light is at an angle Diffuse = EL * Kd * dot(N, L)
Lighting - Specular Mirror Reflection Shininess Blinn-Phong Relates better to micro-facet BRDF theory Uses Half-Vector H = normalize(V + L) Specular = EL * Ks * (H ∙ N)s
PBR Physically Based Rendering Term for any technique that tries to achieve photorealism using a physical simulation of light. The rendering equation Tries to describe how a "unit" of light is obtained given all the incoming light that interacts with a specific point of a given scene.
Custom Shaders Standard Surface Shader Unlit Shader Image Effect Shader Compute Shader
Wrap-Up Questions?