Out now!
2D SHADER DEVELOPMENT
FOUNDATIONS

Make your games unique in a world full of lookalikes by leveraging the power of shaders.

Get it for free!
Join us on Discord

Table of Contents

  • Introduction to the series
    • Motivation for the series
    • I use Unity, why should I bother learning shader programming at all?
    • Who are these books for?
    • I need help! What can I do?
    • Series Overview
      • 1. Foundations
      • 2. Illumination & Shadows
      • 3. Procedural Texture Manipulation
      • 4. Full-Screen Effects
    • Downloading the source code for the exercises
  • Introduction to 2D Illumination
    • Why illumination?
  • Static Illumination
    • Using Additive blend to light things up
      • Particles
      • Refreshing how to implement Additive
    • Using Multiply blend to create shadows
      • Refreshing how to implement Multiply
    • Limits of static illumination
    • Exercise 1
    • Conclusion
  • Kinda Dynamic Local Ambient Lights
    • Creating our own 2D Light Sources
      • Ambient
      • Directional
      • Point
      • Creating the Lights prefabs
    • Object coloring
      • A note on Culling
      • Full code for the shader
    • Ambient Lights
      • Using the TextureWithAmbientLight shader in our character
      • Controlling the gradient shape with _Threshold and _Smoothness
    • Exercise 2: Directional Lights
    • Point Lights
      • Using the TextureWithPointLight shader in our character
      • Adding Point light logic
    • Interpolating between lights
    • Conclusion
  • Screen-Space Automatic Rim Lights
    • Rendering Alpha Only
      • Scene Setup
      • Rendering to a RenderTexture
      • Rendering only the Alpha channel
    • Calculating Normals
      • Blurring the image
      • Generating the Normal map
    • Exercise 3: Lighting
    • Conclusion
  • Dynamic Lights using Normal Mapping
    • Asset Requirement
    • Math derivation
    • Generating the Normal Map in a Shader
    • Exercise 2: Normal Map Generation
    • Using Unity’s native lights
    • Conclusion
  • Where to go now?
    • Continue with the other books in the series
      • Procedural Texture Manipulation
      • Full-Screen Effects
    • The internet
    • Books
  • Acknowledgements
  • Credits
  • Acknowledgements
  • Exercise 1 Solution
    • Lights
    • Shadows
    • Conclusion
  • Exercise 2 Solution
    • Using the TextureWithDirectionalLight shader in our character
    • Adding an angle to the shader
    • 2D Vector Rotation
  • Exercise 3 Solution
    • The RimLights Shader
    • Final touches to ScreenSpaceRimLights.cs
  • Exercise 4 Solution
  • Appendix I: Vector Rotation
    • Rotating with the origin as the pivot
    • Rotating with an arbitrary pivot
    • Rotation matrix in Cg
  • Appending II: Normal Mapping
  • Appendix III: Coordinate Systems
    • Transforming a vertex between spaces
  • Appendix IV: Lambertian Diffuse Shading
  • Appendix V: Convolution
I want it!