This will be the prelude to URP shaders. I'll cover some of the past lessons I did using this as a new lighting setup. If you have new requests or you want to see one of the older shaders using URP, let me know! I hope you found this helpful. If you want to support my Patreon you can do so here ruclips.net/video/UtwJGnif2OU/видео.html
omg, you just slapped me in the face. i was messing around with builtin, never ever wrote a shader, mnaged to hack my way through the standard builtin shader with tons of copy paste, but then i have to implement my vertex shader to all other passes, to make the lighting perfect, i do all of that without a damn clue what i am doing lol. BUT what i see here is full mastery of the subject. insane. ill get my hands on this seriously and get to the next level, cause its so cool. really impressed by your ability to identify each problem's root cause with chirurgical precision, and at the speed of light.
Thank you for this video! I could not find anywhere on the internet how to make a lit custom URP shader. It seems like they want to force you to use shader graph :/ Not only you shoved us how to to it, but you also tought us how and where to look to implement your own custom shader. You also explain everything really well.
Thanks! This is what I was looking for since I'm making a custom fog effect (distance based, not z-depth) but shader graph doesn't let you render unlit parts in a lit shader graph, so I can't make it a solid fog color without lighting... Thankfully with this I can so once again thanks!!! I'd say the only thing missing is support for additional lights other than the main directional light EDIT: for anyone looking to do the same, here's what worked for me: replace this: return UniversalFragmentPBR(inputdata, surfacedata); with this: Light mainLight = GetMainLight(inputdata.shadowCoord, inputdata.positionWS, inputdata.shadowMask); half4 color = UniversalFragmentPBR(inputdata, surfacedata); int additionalLightsCount = GetAdditionalLightsCount(); for (int i = 0; i < additionalLightsCount; ++i) { Light light = GetAdditionalLight(i, inputdata.positionWS, inputdata.shadowMask); half nl = saturate(dot(inputdata.normalWS, light.direction)); color.rgb += light.color * nl * light.distanceAttenuation * surfacedata.albedo; } return color;
Wow. You are really putting in work. There has been a lot of gate-keeping on shader knowledge for too long. Can I ask, what your experience is in compute shaders?
Not enough to really teach it. I can do small things like position a lot of small objects or particles. If I were to try to teach it, there would probably be sections I don't fully understand.
Was hoping to use this to migrate a CRT raster shader I made up to URP for my VR project. And although I get it running I still have the problem that the image is only shown in one of the eyes. I thought this URP thing was supposed to support stereoscopic rendering right out of the box but obviously not.
Amazing description! One minor thing: wouldn't you want to normalize the view direction in the pixel shader instead of the vertex shader, like you did with the normal?
Hello, I've been trying to learn writing shaders but unfortunately any tutorials I have looked at don't work in URP. This one gave me hope but even copy pasting the code in the description didn't seem to get me a shader which appeared. Surely I must be doing something wrong. I haven't changed anything to the project, it is a base URP 3d project in 2021.3.29f1. Any help would be much appreciated
I have a problem that the shader doesn't apply any texture or any color, it's completely transparent unless I made The Render Queue Transparent in unity inspector, but it will only apply the base color but not the main texture
@@alleyesonme1432 The second video of this tutorial series : ruclips.net/video/jlQTQmt_A2U/видео.html there is also the third : ruclips.net/video/oLyv3NSpPeg/видео.html
This will be the prelude to URP shaders. I'll cover some of the past lessons I did using this as a new lighting setup. If you have new requests or you want to see one of the older shaders using URP, let me know! I hope you found this helpful. If you want to support my Patreon you can do so here ruclips.net/video/UtwJGnif2OU/видео.html
You could make another tutorial for ocllusion map
omg, you just slapped me in the face. i was messing around with builtin, never ever wrote a shader, mnaged to hack my way through the standard builtin shader with tons of copy paste, but then i have to implement my vertex shader to all other passes, to make the lighting perfect, i do all of that without a damn clue what i am doing lol. BUT what i see here is full mastery of the subject. insane. ill get my hands on this seriously and get to the next level, cause its so cool. really impressed by your ability to identify each problem's root cause with chirurgical precision, and at the speed of light.
That's exactly what I've been searching for!
Thank you for this video! I could not find anywhere on the internet how to make a lit custom URP shader. It seems like they want to force you to use shader graph :/
Not only you shoved us how to to it, but you also tought us how and where to look to implement your own custom shader. You also explain everything really well.
Thanks! This is what I was looking for since I'm making a custom fog effect (distance based, not z-depth) but shader graph doesn't let you render unlit parts in a lit shader graph, so I can't make it a solid fog color without lighting... Thankfully with this I can so once again thanks!!!
I'd say the only thing missing is support for additional lights other than the main directional light
EDIT: for anyone looking to do the same, here's what worked for me:
replace this:
return UniversalFragmentPBR(inputdata, surfacedata);
with this:
Light mainLight = GetMainLight(inputdata.shadowCoord, inputdata.positionWS, inputdata.shadowMask);
half4 color = UniversalFragmentPBR(inputdata, surfacedata);
int additionalLightsCount = GetAdditionalLightsCount();
for (int i = 0; i < additionalLightsCount; ++i)
{
Light light = GetAdditionalLight(i, inputdata.positionWS, inputdata.shadowMask);
half nl = saturate(dot(inputdata.normalWS, light.direction));
color.rgb += light.color * nl * light.distanceAttenuation * surfacedata.albedo;
}
return color;
Super helpful. Thank you!
Wow. You are really putting in work. There has been a lot of gate-keeping on shader knowledge for too long. Can I ask, what your experience is in compute shaders?
Not enough to really teach it. I can do small things like position a lot of small objects or particles. If I were to try to teach it, there would probably be sections I don't fully understand.
@@benjaminswee-shaders Thanks for your reply. Can you do stuff like marching cube/ray marching?
this was great, I was looking for resources to help me manually convert a BRP shader to URP. This should help.
Thanks a lot! You really helped me very much
感谢!
Was hoping to use this to migrate a CRT raster shader I made up to URP for my VR project. And although I get it running I still have the problem that the image is only shown in one of the eyes. I thought this URP thing was supposed to support stereoscopic rendering right out of the box but obviously not.
Amazing description! One minor thing: wouldn't you want to normalize the view direction in the pixel shader instead of the vertex shader, like you did with the normal?
Hello, I've been trying to learn writing shaders but unfortunately any tutorials I have looked at don't work in URP. This one gave me hope but even copy pasting the code in the description didn't seem to get me a shader which appeared. Surely I must be doing something wrong.
I haven't changed anything to the project, it is a base URP 3d project in 2021.3.29f1. Any help would be much appreciated
same
so we will have to do this every time we want to create a urp shader?
I have a problem that the shader doesn't apply any texture or any color, it's completely transparent unless I made The Render Queue Transparent in unity inspector, but it will only apply the base color but not the main texture
I fixed the problem in the second video
@@glimpsygames2734 Which second video?
@@alleyesonme1432 The second video of this tutorial series : ruclips.net/video/jlQTQmt_A2U/видео.html there is also the third : ruclips.net/video/oLyv3NSpPeg/видео.html
@@alleyesonme1432 Go to his channel, then Playlists, Click on URP Shaders playlist, choose the second video
Invisible in unity 2022.3.2f1
Yes I had to do o.vertex = TransformObjectToHClip(v.vertex); instead of using o.positionWS in the vert block in order to show anything.
@@64jcl hello, I also replaced o.positions with v.vertex, but it's still invisible. Can I ask you for help?