Cyanilux / URP_ShaderGraphCustomLighting

Some custom lighting functions/sub-graphs for Shader Graph, Universal Render Pipeline
MIT License
558 stars 63 forks source link

Vertex Lit Support #17

Closed F11BOT closed 1 year ago

F11BOT commented 1 year ago

Thank you for you work, it has helped me a lot exploring new ideas and learn about shaders without having to mess much with shader code!

There is a way to set every shader to vertex lit, but I wanted to make only some of them using this technique to have better performance, is there a way to make a vertex lit shader using your resources?

Cyanilux commented 1 year ago

Should be possible to do lighting calculations in the Vertex stage in Shader Graph by using a Custom Interpolator. For info/examples see : https://www.cyanilux.com/tutorials/intro-to-shader-graph/#custom-interpolators https://docs.unity3d.com/Packages/com.unity.shadergraph@14.0/manual/Custom-Interpolators.html

In particular, I think the usual vertex lighting that URP uses applies only to Additional Lights (and just diffuse), so you'd want to pass that subgraph through the interpolator. Could also handle Main Light calcs in vertex stage as that may be cheaper.