this is a fantastic tutorial that actually explains what each step actually does and how to find more resources for it too. Tho some explanations were missing, i spent half hour figuring i had to put curly brackets in the hlsl shader ^^''. Will you some day do a tutorial on how to add additional lights with this method too?
Thanks! its my first tutorial, so its def not perfect! I plan on doing additional lighting at some point, and to update this to work with forward+ rendering!
Thanks! I plan on eventually adding to the tutorial, the next update will be on forward+ renderer and additional lighting. Baked shadow maps are on the docket but not for a while!
Great tutorial, but I wasn't able to make the shadows work even though the node arrangement is exactly the one from the tutorial. The keywords seem to do nothing.
Thanks for the great tutorial! Though I didn't get the shadow to work😂. Are all three keywords set to multi compile, global, and default? The last two in the videos are not set to these settings and I feel a bit confused.
You're welcome! Yes they should be, I think I forgot to set them while I was recording, but that's how they're set in my project. Be sure you are multiplying the color by shadow attenuation!
I have a problem. "Shader error in 'Shader Graphs/Master': syntax error: unexpected token 'Direction' at line 4" What did I do wrong? My code void GetLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float Attenuation) #if defined(SHADERGRAPH_PREVIEW) Direction = float3(0.5, 0.5, 0); Color = 1; Attenuation = 1; #else float4 sCoord = TransformWorldToShadowCoord(WorldPos); Light mainLight = GetMainLight(sCoord); Direction = mainlight.direction; Color = mainlight.color; Attenuation = mainLight.shadowAttenuation #endif Thank you in advance
@@hipperdiscuits I'd need to see full code posted to say anything about it. The above code that @tartess3978 posted has many other mistakes that I didnt see the first time, there are no curly braces and some missing semi colons
yes, you need to loop through all of the additional lights in a custom function. I think the method is called GetAdditionalLights(worldPos) or something (its in the shader files i was talking about!) The problem with additional lighting in shader graph is that shader graph cant loop, so you have to decide what you want to be calculated in the custom function and give it parameters according your needs. I still haven't settled on any single approach for additional lights
Fantastic tuto, that perfectly encapsulates my despair 😂
this is a fantastic tutorial that actually explains what each step actually does and how to find more resources for it too. Tho some explanations were missing, i spent half hour figuring i had to put curly brackets in the hlsl shader ^^''.
Will you some day do a tutorial on how to add additional lights with this method too?
Thanks! its my first tutorial, so its def not perfect!
I plan on doing additional lighting at some point, and to update this to work with forward+ rendering!
Nice tutorial and also very entertaining!
thank you!
Just Incredible men !!!!!!!!!!!!!!! U help me so much!
any idea how to apply an outline to this shader?
Great video, thanks! Is it possible to draw only drop shadows without self shadows?
How do you go about lights other than the main one? i dont really see a way to loop through lights in shader graph
tutorial is good but how to add baked shadowmaps?
Thanks!
I plan on eventually adding to the tutorial, the next update will be on forward+ renderer and additional lighting. Baked shadow maps are on the docket but not for a while!
Thanks, but can you teach me how to make it accept the shadow
Great tutorial, but I wasn't able to make the shadows work even though the node arrangement is exactly the one from the tutorial. The keywords seem to do nothing.
Did you set the keywords to global and multi-compile?
@@spacemicroscope the global/local setting is missing
@@spacemicroscope Turns out the problem was I was using an unstable version (Unity 6 preview). Thanks for the tutorial and the answer!
@@gRIO904 How did you end up fixing it? I also dont have the global / local setting, but im on 6.0.28 which is LTS
Thanks for the great tutorial! Though I didn't get the shadow to work😂. Are all three keywords set to multi compile, global, and default? The last two in the videos are not set to these settings and I feel a bit confused.
You're welcome! Yes they should be, I think I forgot to set them while I was recording, but that's how they're set in my project. Be sure you are multiplying the color by shadow attenuation!
I have a problem. "Shader error in 'Shader Graphs/Master': syntax error: unexpected token 'Direction' at line 4"
What did I do wrong?
My code
void GetLight_float(float3 WorldPos, out float3 Direction, out float3 Color, out float Attenuation)
#if defined(SHADERGRAPH_PREVIEW)
Direction = float3(0.5, 0.5, 0);
Color = 1;
Attenuation = 1;
#else
float4 sCoord = TransformWorldToShadowCoord(WorldPos);
Light mainLight = GetMainLight(sCoord);
Direction = mainlight.direction;
Color = mainlight.color;
Attenuation = mainLight.shadowAttenuation
#endif
Thank you in advance
i'm not sure "#if defined(SHADERGRAPH_PREVIEW)" is proper syntax for cg/hlsl or whatever macro this is
instead write "#ifdef SHADERGRAPH_PREVIEW"
I'm getting the same issue but changing the syntax didn't fix it. Any other thoughts on what might be causing this? Thanks!! @@spacemicroscope
@@hipperdiscuits I'd need to see full code posted to say anything about it. The above code that @tartess3978 posted has many other mistakes that I didnt see the first time, there are no curly braces and some missing semi colons
Had the same problem and found the solution:
There needs to be curly brackets{} surrounding the code before the #if and after the #endif
@@spacemicroscope same problen
Great Tutorial!, i have a question, do you know how to add more lights? like point lights anda spot lights.
yes, you need to loop through all of the additional lights in a custom function. I think the method is called GetAdditionalLights(worldPos) or something (its in the shader files i was talking about!)
The problem with additional lighting in shader graph is that shader graph cant loop, so you have to decide what you want to be calculated in the custom function and give it parameters according your needs.
I still haven't settled on any single approach for additional lights
❤that's useful for me,thanks for your share
Nice, thanks! But i don't get it, what should i do to control strength of shadows :D
the gradient controls how dark the surface can get, You don't even have to stick to greyscale!
@@spacemicroscope Wow such fast answer o:
Anyways i did it stupid'ish way by using lerp i.imgur.com/zV2rIe7.png
bravo merci
I can show you the wold
wold (edited)