#How to include additional lights in a stylized unlit URP shadergraph?

1 messages · Page 1 of 1 (latest)

silver glacier
#

Hi, by following a lot of tutorials and doing a lot of experimenting, I managed to make an unlit shader that I think is pretty cool to use in my games, I was bored of always using a simple toon shader and only copying tutorials, while I still don’t know any hlsl, I managed to build the shadergraph mostly all by myself, in the image I attached are some examples of what I could make with just messing around with material surface inputs, and on the right is the preview of the additional lights setup I want to add on top.

Everything was smooth sailing until I tried to get it to support those additional lights, I followed a couple of tutorials, particularly this one by Daniel Ilett: https://www.youtube.com/watch?v=F8bAI6dIrto

Up until the part where he automates the process in the script, before attempting to do that, I wanted to get it to work for at least one additional light inside shader graph to see if it looks like I would want it to look, which is more or less like the node setup in the image.

This setup was made with a custom function using the additional lights that were added to the hlsl script as the tutorial showed, but no matter what I try I can’t get this to be reflected on the material once I plug it into the base color either with an add node alongside the rest of the setup, or on it’s own just to see if it’ll work at all, all I get is a black material.

I know I must be doing something wrong but I don’t know what it is, graph settings and such is all on default, I already checked that additional lights are set to per pixel in the URP asset like I saw suggested elsewhere. Any help is greatly appreciated and thanks for your time.

Unity only provides a Main Light Direction node for custom lighting. If we want more fine-tuned control and support for color and additional lights, we'll need to delve into the world of ✨custom HLSL code✨. With Shader Graph's Custom Function node, we unlock plenty of new opportunities!

I'm using Unity 2022.3.0f1, although these steps shoul...

▶ Play video
lucid bone
narrow timber
#

Did you look how it's done in the custom lighting samples from Shadergraph package ?

silver glacier
silver glacier
#

the problem was actually that the renderer was set to forward + instead of forward, but thank you nonetheless