Hello, I am here to make a shader based lighting without using the engine’s lighting system to reduce resource usage on mobile devices. I succeed to make a lighting mask by basing on the point and size which passed from the script outside which I created.
But, I got a problem here which is I can’t blend the light cookie texture into the light mask that just generated from the custom function (HLSL) just like using cookie texture in engine’s lights.
Can I have any advices or answers for this or is it possible? I have already searched a lot through net and ai but did not see any solution which I wanted.
And is this the correct way to improve performance on mobile devices? Thanks in advance!
Please ask me if you need more information. Oh! Pipe line using on this project is URP.
The HLSL I am using :
float3 lp = LightPosition;
float lr = LightRange;
float3 pp = PixelPosition;
float lbf = LightBorderFade;
float bfs = BorderFadeSmoothness;
float dist = length(lp-pp);
float t = ((lr+lbf)-(lr-lbf))-((lr+lbf)-dist);
float4 smoothRes = lerp(float4(1,1,1,1),float4(0,0,0,1), smoothstep(lr - bfs, lr + bfs, t));
ColorOut = smoothRes;
These are the Screenshorts :