Skip to main content
100%

Gist 2cf3965eedaf296437ff9c2c7ca7ca8a

✓ Published0🌍 Public
Aandybak
Last edited Jul 16, 2018
Created on Jul 16, 2018

This Unity shader example demonstrates a custom lighting model with diffuse reflection for both vertex and pixel lights. It shows how materials respond to multiple light sources, combining ambient, directional, and point/spot lighting using additive blending. The shader uses Unity's CGPROGRAM syntax, leveraging built-in variables like `unity_4LightPosX0` and `unity_LightColor` for vertex lighting, while `_WorldSpaceLightPos0` handles additional light attenuation. The code includes two passes: a ForwardBase pass for ambient and vertex lights, and a ForwardAdd pass for supplementary lights, with linear distance-based attenuation for point sources.

AI-generated description

Similar vizzes