https://unity3d.com/how-to/novel-lighting-workflow-in-Unity
✓ Published0🌍 Public
Aandybak
Last edited Jul 16, 2018
Created on Jul 16, 2018
This example shows a custom lighting calculation for vertex-lit objects in Unity, reducing the cost of multiple directional lights by packing their data into vector4 arrays. The `ShadeVertexLightsAtten.cginc` file defines a function that computes diffuse lighting and distance-based attenuation for four lights simultaneously, using arithmetic on `float4` types to process all lights in parallel. It reads light positions, colors, and squared attenuation factors, then sums the weighted contributions into a single output color. The code relies on Unity’s shader language (CG/HLSL) and its built-in vertex lighting pipeline.
AI-generated description