PLEASE READ THE WHOLE THING SO YOU DON’T SUGGEST THINGS I ALREADY TRIED.Thank you
I am trying to create a .hlsl file to get custom lighting for shader using shader graph, but the include won’t work. I am going crazy because all video I’ve seen don’t need to include it because it is automatically included. So what is wrong with it? I even made a new project to see if there was corruption in my URP project.
#C:\Users\User\Documents\Games Repository\TLS\Library\PackageCache\com.unity.render-pipelines.universal@10.4.0\ShaderLibrary\Lighting.hlsl"
I shouldn’t even have to include this file because it should be automatically included but I get this error instead: Shader error in ‘Shader Graphs/Cel Toon Shader’: undeclared identifier ‘CalculateMainLight_float’ at line 233 (on d3d11)
Here is my hlslcode:
Code
#ifndef UNIVERSAL_LIGHTING_INCLUDED
#define UNIVERSAL_LIGHTING_INCLUDED
void CalculateMainLight_float(float3 WorldPos, out float3 Direction, out float3 Color)
{
#ifdef SHADERGRAPH_PREVIEW
Direction = float3(0.5, 0.5, 0);
Color = 1;
#else
Light mainLight = GetMainLight(0);
Direction = mainLight.direction;
Color = mainLight.color;
#endif
}
#endif