Wow, the water is really starting to look great. I feel like this tutorial series could go on for some weeks. Depth, edge interactions, foam caps, directional waves, and underwater shader could all be their own tutorials.
@gitgud156811 ай бұрын
Even though i only watched couple of videos of you, i still tend to follow your content time to time on twitter and here for a couple minutes and admire your dedication to your art and discipline. Thank you for creating great content
@mlecz11 ай бұрын
In the previous video you touched on a lot of optimization issues which was fantastic. What I miss in this video is the mention of the 'Single Layer Water' Shading Model. You are using Default Lit with transparency which for water alone is pretty heavy.
@BenCloward11 ай бұрын
Yes, very true. However, if you're basing your "pretty heavy" assessment on the number of instructions a transparent shader uses, you may want to look at it more closely. Transparent shaders are a bit more expensive than opaque ones, but no where near what the instruction count might lead you to believe. Transparent objects are rendered in the Forward pass - which means that the shader contains all of the code to do lighting, reflections, ambient, fog, etc - which opaque shaders do not have. So you can't compare the instruction counts of transparent objects with opaque ones to get an accurate performance assessment. Another challenge I run into in this situation is that both Unreal and Unity have built-in water shaders, but their implementation and results are very different from each other. I'm doing my best to present content that is very similar between the two engines, so I chose to do it this way rather than present two separate and very different systems that are very engine specific. Maybe not what some users are looking for? Not sure, but it's always been my goal to teach shader techniques instead of engines.
@jihadrouani552511 ай бұрын
Thanks Ben for the amazing tutorials as usual, I hope you have more and more cool shaders and effects to teach us!
@re512811 ай бұрын
Great! Ben is "the man" when it comes to tutorialsl. since years top notch.
@andyetnotwant9 ай бұрын
the chromatic aberration stuff in unity was really cool and i wanted to get that working in unreal too. i don't really know why screen position or scene color in unity is a float4 but after masking out the r,g of my normals in unreal i got it to work. so is doing it this way just kind of manually rebuilding how the refraction output is actually working? also haven't figured out how to blur in unreal like you are in unity yet.
@PRodi_10 ай бұрын
Great tutorial! I'm doing all of this in URP, but is there a way to achieve the same functionality as the 'HD Scene Color Node' in URP?
@BenCloward10 ай бұрын
You can use the Scene Color Node instead. It doesn't have the LOD control, but otherwise it's the same.
@PRodi_10 ай бұрын
@@BenCloward Thank you, your solution is working nicely! P.S. I actually found that the main issue was forgetting to turn on Opaque Texture in URP :)
@Oscar-tw3uq11 ай бұрын
thanks for this amazing tutorials
@jashdamania8392Күн бұрын
the water shader only works when lookin in one direction when looking in an opposite direction it breaks... it looks as if the water is divided into two parts on is the transparent part and the other just shows an ochre color due to the scene color (im doing a beach scene... so the scene color just samples the sand texture) any fix for this ?
@BenCloward14 сағат бұрын
Unity or Unreal? And are you talking about being under the water and looking up at the underside of the water plane? Sorry I'm not understanding your description of the problem very well.
@gorantrpkov44610 ай бұрын
Hey Ben. Thank you for the great tutorial! I want to ask something a bit unrelated to this specific tutorial. If I was to get a bit more in-depth about writing shaders, HLSL in particular, I see that there are quite a few books on your resources page as recommendations. Some of these are written quite a while ago, are there more up to date resources you can recommend, considering that there are new features coming to Unity and Unreal all the time, or you'd say that the way shaders are written is quite universal and all these books are as much relevant today as they were a decade or two ago? Thanks!
@BenCloward10 ай бұрын
HLSL itself doesn't change very quickly. There are really only major updates to it when a new version of DirectX is released (which only happens every 5 years or so) and even then the changes and additions to it are minor. And the core techniques, concepts, and math that people need to understand to use it - how lighting calculations work, etc - those don't change at all. So even if you're looking at a book that is more than 10 years old, chances are almost all of what it teaches is still very relevant. The list of books on my site are the books that I learned from over the years and I'm still using that understanding now. Having said all of that, there are two recently published books I would recommend: Essential Math for Game Devs - amzn.to/3vUDGRc (This has great explanations of essential math concepts) The Unity Shaders Bible - amzn.to/3So7AEY (This is more Unity focused but does teach HLSL coding)
@gorantrpkov44610 ай бұрын
@@BenCloward Thank you so much! That totally makes sense and thank you for replying so quickly!
@deianSM10 ай бұрын
Hey Ben! Thank you very much for all this videos as usual! I was wondering if you think it will be possibile to achive some kind of SSAO or HBAO using the full screen shader graph pass in unity? Would you eventually consider making a specific video on Ambient Occlusion? Thank you again and keep up the good work!
@BenCloward10 ай бұрын
It can be done, yes, but the graph could get pretty huge. The problem is that techniques such as SSAO require loops and graph tools like Shader Graph don't support looping so you just have to copy and paste nodes over and over. It's hard to show something like that in a video tutorial because of how complex it gets. Doesn't mean I won't look into it and try though.
@deianSM10 ай бұрын
@@BenCloward Would it be possibile to implement those loops and perhaps the more complex parts of such a shader using custom hlsl code nodes? It would be amazing to have a custom AO implementation in unity so that it can be tweaked in different ways (like dotted pattern for cartoonish stylized rendering and stuff like that). I would love to try and tackle on such a problem but the fact is that I'dont have a clue for what is the logic behind an AO implementation. If you could even point me towards some resources that offer some insight on this I would greatly appreciate it! Thanks again!
@thetego11 ай бұрын
Do you have any plan about showing surface ripples with vertex displacement too instead of normal maps and maybe domain warping for wave push pull effect?
@suraj.188910 ай бұрын
You are such a great teacher.
@diego636111 ай бұрын
Hey ben this is amazing, any plan to make some wind based Vertex Shader exercices, i have seen trees like in War Thunder that have some really nice wind effect to the branches and trunk
@BenCloward11 ай бұрын
Thank you for the suggestion! I'll look into that.
@juanmilanese11 ай бұрын
great video. I have a question about the fresnel node. In the docs examples they pass the normal map into a transform vector node (from tangent space to world space) before sending into the "normal" slot of the fresnel node. You just sent the normal directly (albeit toned down) and honestly... it looks good to me is there any technical reasoning behind going one way or the other?
@BenCloward11 ай бұрын
It was a mistake - but I got lucky. In the case of Unreal, normals on an up-facing plane in tangent space very closely match world space normals. As long as the up-facing plane isn't rotated, the transform isn't needed! But it would be better to use it, I think.
@Bulborb111 ай бұрын
Thanks Ben!
@davidcsakvari76211 ай бұрын
Nice tutorial, but isn't the IOR of water 1.33? Why are you putting 0.75 there now, it looks better?
@BenCloward11 ай бұрын
Great question. This input port isn't asking for the IOR of water, but rather the IOR of air divided by the IOR of water. You have to divide the IOR of the source medium by the the IOR of the destination medium to get the correct refraction. So air's IOR is 1.0003 and water's IOR is 1.333 - so the air IOR divided by the water IOR gives us 0.75..
@davidcsakvari76211 ай бұрын
@@BenCloward Interesting, maybe you are right but it is strange to me that in all the unreal documentation this is not mentioned and in the examples they give ior values like 1.52 for glass or 1.33 for water.
@davidcsakvari76211 ай бұрын
They even use fresnel like you did in your old videos
@JackMartison11 ай бұрын
How do you rate built-in water solution in Unity? Is it worth to use it in production as object that doesn't involve any gameplay elements, or cheaper shader from scratch would be more efficient?
@BenCloward11 ай бұрын
The built-in water shader is really good. If it's for a background element, you can probably make something cheaper yourself that gets the job done but costs less performance. The advantage of using the built-in solution is that it's already done and you can use it out of the box. Doing it yourself is more work, but you can also customize your own solution to reduce cost and get exactly what you need.
@oostenmusic8 ай бұрын
FOR ANYONE WITH OUTLINES AROUND THEIR REFRACTED OBJECTS - Turn "translucency pass" on your material output to "before DOF". I spent many hours banging my head against a wall before realizing that the fix came from a simple switch
@itay711 ай бұрын
Is this type of shader math too expansive in Unity compared to Unreal Engine? Asking because it looked kinda laggy when you started using transparency on the Unity shader graph
@BenCloward11 ай бұрын
OBS was struggling with recording my 4k screen at 60fps. It ran fine for me, but the recording I ended up with was really choppy. I've since made some adjustments to my recording settings. Hopefully it will be improved in the next video!
@ledpill10 ай бұрын
If i put opacity to zero like you did in the beginning my water is gone completely as yours but i don't have any caustics either.
@BenCloward10 ай бұрын
The caustics are created by a separate decal material.
@ledpill10 ай бұрын
@@BenCloward will you make a tutorial on that too? :D
@BenCloward10 ай бұрын
@@ledpill I already did a couple of years ago, but I'll do it again in a few weeks just so people don't miss it.