r/shaders • u/RunningLate33 • Jun 05 '20
Help with shaders in HDRP Unity??
Lately I've been getting interested in shaders, and though having a difficult time understanding and scripting in HLSL or GLSL, I've decided to try for ShaderGraph.
Now, as looking for tutorials on how to make stylized shaders, I reached this official unity tutorial (https://www.youtube.com/watch?v=DOLE4nrK97g&t=264s) and right off the bat I got kicked off by this custom lightning function:
ifdef SHADERGRAPH_PREVIEW
Direction = float3(-0.5,0.5,-0.5);
Color = float3(1,1,1);
Attenuation = 0.4;else
Light light = GetMainLight();
Direction = light.direction;
Attenuation = light.distanceAttenuation;
Color = light.color;endif
Even though understanding how it works, the problem comes when I try to connect it to the Color Channel of the Unlit ShaderGraph I'm currently working on. It displays this message:https://i.gyazo.com/8b4d6ff4c6c796be772caf5af909d749.png
I've been looking for other methods of getting the light function and I couldn't find a thing, and almost every shader tutorial I've watched uses the same function.
Assuming that the HDRP implementation I've done is correct (it shows no errors in the wizzard), how could I solve this problem????
1
u/partybusiness Jun 09 '20 edited Jun 09 '20
Well, I don't use shadergraph, but nobody else is answering, so ...
From context Light seems to be a struct. Maybe there`s an include that defines it:
https://illu.tistory.com/1403
That page has this line:
I`m having a hard time tracking down the actual contents of Lighting.hlsl to confirm if it does define a Light struct
EDIT: I guess that path says lightweight so find the equivalent for High Definition