Local Volumetric Fog - Advanced Materials - Episode 23
HTML-код
- Опубликовано: 16 сен 2024
- In this tutorial video for Unreal and Unity, I show the basics of creating shaders for volumetric fog volumes. This is different from our standard surface shaders - because they deal with 3D space instead of a 2D surface. Then we jump in and create a billowing smoke shader.
Here's last week's video on retroreflective shaders:
• Retroreflective Road S...
Here's the playlist for all of the videos in the series:
• Advanced Materials
Shader Book Recommendations
www.bencloward...
------------------------------
Theme Music
Peace in the Circuitry - Glitch Hop
teknoaxe.com/Li...
Background Music
Speo - The Little Things
• The Little Things
#UnrealEngine #shadergraph #Unity
------------------------------
I've been watching your Beginner Series and I'm overjoyed to see you still uploading and on advanced topics. You really are a gem to the community.
Unreal starts: @26:30
thanks bro
I saw "local" and "fog" in the same sentence in YT notification, that was all I had to see to drop everything I've in hand and watch this, I've no doubt it'll be another super awesome video, thanks as always =]
Hi! This is exactly what I was looking for!!! Thank you so much! For Unreal 5.3 the Object Local Bonds node (wich is now of color red) is slightly different, here's how I connected this node: "Extents" to Divide B and "Min" to Subtract B
Awesome tutorial as usual Ben. There really isn’t a ton of great ones out there. I’m hoping you continue this as a series and add shadows and show us ways it could swirl around objects in the environment. Epic showed off some of that in a long chat, but they didn’t go in depth on how to implement. Good stuff as usual!
For unreal there are some console commands that you can set to control the quality
r.VolumetricFog.GridPixelSize (number)
Lower is better quality but more expensive
r.VolumetricFog.GridSizeZ (number)
Higher is better quality but more expensive
I've found that these give the best results without completely decimating performance:
r.VolumetricFog.GridPixelSize 3
r.VolumetricFog.GridSizeZ 256
Finally local fog! Thank you Ben!
Amazing work Ben :D! In 5.3 the Object Local Bound node is different but here is the code to the one Ben is using in his video. Just copy the code and paste it on your node graph:
----------
Begin Object Class=/Script/UnrealEd.MaterialGraphNode Name="MaterialGraphNode_0" ExportPath=/Script/UnrealEd.MaterialGraphNode'"/Engine/Transient.SHaderTest:MaterialGraph_0.MaterialGraphNode_0"'
Begin Object Class=/Script/Engine.MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_0" ExportPath=/Script/Engine.MaterialExpressionMaterialFunctionCall'"/Engine/Transient.SHaderTest:MaterialGraph_0.MaterialGraphNode_0.MaterialExpressionMaterialFunctionCall_0"'
End Object
Begin Object Name="MaterialExpressionMaterialFunctionCall_0" ExportPath=/Script/Engine.MaterialExpressionMaterialFunctionCall'"/Engine/Transient.SHaderTest:MaterialGraph_0.MaterialGraphNode_0.MaterialExpressionMaterialFunctionCall_0"'
MaterialFunction=/Script/Engine.MaterialFunction'"/Engine/Functions/Engine_MaterialFunctions02/ObjectLocalBounds.ObjectLocalBounds"'
FunctionOutputs(0)=(ExpressionOutputId=313C7572466CA27A23CDA3B4154F2316,Output=(OutputName="Local Bounds Minimum"))
FunctionOutputs(1)=(ExpressionOutputId=84309F4A40C6E678F1735DBB1536E381,Output=(OutputName="Local Bounds Max"))
FunctionOutputs(2)=(ExpressionOutputId=B7B642B942F53C15A85B7A8DF1654AF9,Output=(OutputName="Local Bounds Size"))
MaterialExpressionEditorX=-627
MaterialExpressionEditorY=-10
MaterialExpressionGuid=9BB9686F4F65D63E7CCAF0A1CF0E129A
Material=/Script/UnrealEd.PreviewMaterial'"/Engine/Transient.SHaderTest"'
Outputs(0)=(OutputName="Local Bounds Minimum")
Outputs(1)=(OutputName="Local Bounds Max")
Outputs(2)=(OutputName="Local Bounds Size")
End Object
MaterialExpression=/Script/Engine.MaterialExpressionMaterialFunctionCall'"MaterialExpressionMaterialFunctionCall_0"'
NodePosX=-627
NodePosY=-10
NodeGuid=52C21C7F4EF836927FD75589D36FD3BB
CustomProperties Pin (PinId=ADDDD66D4D5A69E09320E887009565B7,PinName="Local Bounds Minimum",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F29B0B4F4B86C7FF129A65A0A4E55380,PinName="Local Bounds Max",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=95E4B13048AAE471995873BC4BB8E74C,PinName="Local Bounds Size",Direction="EGPD_Output",PinType.PinCategory="",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
--------------
Wow Noice !
This is quite interesting! I was doing something in Unreal similar but with niagara for steamy hot water, and I think this could be more easier to apply to. Thanks for the tutorial as always!
Hey Ben. Such a great tutorial. Love all you vids. It’s so good to have someone properly explain what they are doing instead of just doing it. Just a note on this vid, maybe add chapters so people can skip. I have no interest in unity and when I refer back I have to scrub through
Thank you - and thank you for the suggestion about the chapters. That's a good idea.
Thank you for the knowledge.
The ben cloward way of doing things is always a bit more refined from what i come up with 😂 time to update another shader
This is amazing, thank you for the thorough explanation! Definitely will put this to use.
The “Object local bounds” in your material node graph doesn’t seem to be in ue5.3. Is there a walk around?
Thanks
Hey, create " local position " node. Click it then change its material function to " object local bounds ".
@@4lifescrea Ben needs to pin this
thanks! @@4lifescrea
@@4lifescrea Thank you!
Mate, you’re a legend. Thanks man!
A legend among legends
This video helped me a lot, thanks king.
Thank you for the video i love all these shader videos 🙂
where do i get the textures you use from,in unreal engine 5
What parameters are you using so smooth out the results in unreal? with the defaults mine looks pretty blocky. I'm adjusting r.VolumetricFog.GridPixelSize and r.VolumetricFog.GridSizeZ and it does improve but I just can't get it to look as smooth as yours? Also will you be covering the other effects we see at the beginning?
The fog is spiky and looks low res in my project. I have set scalability to high and also tried cinematic but its not really chaning anything. What could be causing this?
The texture or the tiling of the texture
If the texture is so noisy it will give you spiks
Try making the texture a lot bigger
Hi Ben, first of all let me thank you for all your hard work and tutorials. You are the reason people like me can learn how to work with materials and only because of you I started learning all about the art that shaders can provide. I would like to ask one thing that is unclear of me if a materia for example water shader has 2 methods of creating flowing ripples each suitable for different space of water and I switch between them using a boolean as a parameter, will both calculation proceed so the shader will be as expensive as using both methods at the same time or will the shader use only the calculation that is affecting the final output so the other one will not calculate. In other words, would it be better to use different master materials for each method or one material main for all? Thank you again for all your work and the time you put into your videos.
This is amazing!!
YOU are the BEST !
Excellent tutorial. Love your videos, very explained.
I was wondering if there's any possibility to create an emissive fog like this one in Unity. I see there's no emissive input node on the fog graph and adding it directly to base color won't do much. I wanted this type of fog on a dark corridor, but the lack of light makes it very hard to see, and I don't want to add more lighting to the scene. Do you think it would be possible some how?
ty
maybe i missed something, but I had a bug where the fog gradient was inverted, instead of (1.5) on flatten I had to use (-1.5).
you can also invert then subtract that sphericle square mask he made at the beginning of the from the final result to bring back the shape control
i was thinking about the same thing but i cant seem to be able to recreate it. if i put the shape there and subtract it, i still see very clear and sharp edges of the fog. care to elaborate?
In Unreal section, by the end you don't connect the Distance nodes at the very bottom to anything? Are those needed? The notes that determine the shape and falloff?
Those nodes generate a spherical falloff. I used them at the beginning to illustrate how to create something basic inside the volume, but the smoke effect I created didn't need spherical falloff - so I didn't use them for that technique.
This with simple interactions like walking thru and removing at player position and slowly coming back would be cool
Thanks, this is going to be so helpful to me! It would be helpful if you talked a bit about how expensive shader techniques will be in your videos -- like whether or not something will work for mobile or VR; or if it's meant more for archvis or whatever.
Awesome, in Unreal how did you get the 'extinction' input in the material? is that in the shader settings? I don't think you mentioned that in the video, I don't have it open in front of me to look.
This is nice. I wish Unreal would buyout and integrate Ultra Dynamic Sky, Fluidninja (fogs/smoke) and Fluid Flux (flowing water) or build a unified system. These prebuild systems are pretty well optimised, and have a ton of easy to use and powerful features. This would really help to lower the barrier for artists.
is there a way to connect this to a flow map so that the fog appears to move around obstacles like hills?
I came here for UEFN help, and unfortunately there is no ObjectLocalBounds within the Materials section. Can't make a fog volume without that, can you?
is there any way to make this work with path tracing?
A lot of great stuff here. Thank you. I'm sure you probably know, but Named Reroute Declarations nodes can really help to clean up material graphs.
Ben, thanks again on your awesome contributions, I've been learning from you for a few years now.
I tried to apply volume material on mesh particles in UE5, and it seems like volume bounds are computed from all particles combined rather then each individual particle, so I get a large wall of smoke rather than a smoke trail. Do you know if it is possible to set a volume material so that it follows individual particle bounds?
It is really Cool!Thank you teacher!
Hi, I'd love to know if we can somehow make this material can cast shadow?
It would be super interesting to see cloud materials
Hey Ben, thank you very much for this video! How would you go about adding AO/Self-shadowing to this volume (Unreal)? I'm playing around and I think your height blend looks REALLY good but AO would probably add that extra spice. If I end up finding a good solution I'll add another comment XD
Please lemme know if you find a way to add shadows and AO to this for realism! Thanks! :)
yeah actual AO plugged into the nodes would be god tier, the only trick I was able to do is to use distance fields to tint the albedo so you get some fake AO going on. (Fog gets darker the closer it is to the ground)
Same :(
using 5.3 and shadows had to be set to high in scalability or else the fog doesn't show up, in case anybody has that issue too :)
what if i dont have "object local bounds" node.. it is red and have different pins on 5.4...
hi! ben thank you for your tutorial,but i have a question,
When camera moves far away,the volumetric fog will disappear ,i try to figure out that why, Spent a lot of time with no results
Same problem, I don't know why...
I've made a few Volumetric systems many different ways & it's obvious when someone knows the Material system like yourself vs some who knows a few nodes VS well "creative people" when it comes to the Fog set up. I've been tiling off World position via param, Divide, Multiply For XYZ which I though was a advanced way to do it, no idea you could do it like this (I guess my 3D texture fog is a like this for some of them. The others use "XYZW" MF's). Gives me a lot to think about going forward.
i ll credit Ben Cloward on mu job resume
More like Ben Cloudward
Ah - that's a good one.
Great Video! Very nice effect, at least in UE5. Been trying to figure out how I can invert the fog, so all of the fog generates and flows around the border with the middle relatively clear. Having a super hard time conceptualizing the solution for some reason.
Hi,
I'm using this on UE, for some reason I can't get close enough to the fog. Whenever I try to get closer it disappears. What settings needs to be modified?
Very useful content!
I would like to know what I need to study to get this idea!
Not sure if I'm doing something wrong but my fog is disappearing the farther I move from the box. Does this happen to anyone else?
try looking in your Exponential Height Fog actor and set View Distance to something higher
Awesome as always Ben! Question: Mine fades out when the camera moves further back from the volume. Is that in the Exponential Height Fog settings?
yes. try setting fog viewdistance to a very high value and you should see the effect in the distance. Not sure about the performance impact of rendering something like this in the far distance, though
33:32 How do you get these Constant 2Vector pins? When I get the "Constant 2Vector" I have no X and Y and no RG pin. Im new to materials btw
Awesome Channel and guides!
BTW Im using Unreal 4.27, is there any way to still have this pin/pin result?
Hold 2 and left click for 2 vector, 3 for 3 vector, 1 for constant
That's so nice! Great Tutorial. This got me an idea. Do you think it is possible to use it as fog of was for a strategy game using the char position to mask the fog? I will do some test as soon I find some time! :D
fog of war*
Cara você não ensinou a fazer o Material Volume Fogo
Conseguir fazer mais so funciona com a qualidade gráfica acima do médio no caso no alto, se for do médio para baixo o shader some
Thank you so much. Perfect Timing...I NEEDED this for UE5. In UE5, will gravity make the fog fall if I raise it above the ground?
No
❤❤❤
I want to ask you
If i want to put noise in normal what node is used between them in unity
Sadly, it doesn’t react to the light. So, you’d have to calculate self-shadowing and color by yourself, and that requires ray marching.
I am pretty sure it is lit by lighting, has been since ue4. Games have had lit, performant volumetrics since forever in many engines.
Been playing God of war recently on PS4 that has some nice ground fog with light beams going through it, albeit a little low res.
I assume using this technique for ground dust clouds is cheaper on peformance than niagara particles, or not?
I believe that may be true, but I'd want to test it to be sure. It would depend a lot on how many particles you decided to use in the niagara effect.
Coool!
Hello! thanks for your content, it's really useful 😊 I'm having some trouble with it tho, the fog turns black when I try to render it, any help would be appreciated :)
Would something similar be possible with fire? By simulating fire in a DCC package such as Houdini or Blender and rendering out "slices" of the flames. Maybe panning noise against their UV's to make the flames dance? Or even a flow map. Do you think having a 3D flow map texture would be too much?
Thank you for all the incredibly valuable content you post!
Yes, that is very doable. In fact, I think Epic just added a feature for doing exactly that in Unreal 5.3.
Oh, neat - thank you for the help! I’ve got some renders planned that would benefit greatly from such a technique
哦,amazing
Thanks a lot ... These kind of Effects can be simulated by VFX tools too ... i wonder which way will be more performance friendly ?
Hey, is it possible to increase the draw distance of this volumetric fog? So we can see it far away
It is possible, the the larger the volume is, the more samples are required to render it, so it's more expensive to render when it's larger. So you have to find the right balance between size and cost.
man, this is so hard...
I love your videos, but I don't like how you mix Unity and Unreal videos. To understand the beginning of the Unreal Engine part we need to watch the Unity part. No problem with both content, the problem that I see is mix information. Ps.: I can't wait to see the water material complete.
Fog!
Holy
URP, how/when ?
it something like what fluidnija do.
URP doesn't support the volume fog component, is there a way to create this effect in URP?
There isn't a way to do this in URP, no.
@@BenCloward I have already suggested to Unity a URP version of the volumetric fog in the roadmap site, hopefully they consider it. But I saw so many volumetric fog shaders in Unity assets store so it must be possible I think.
@@jihadrouani5525 it’s possible, but you’d have to create everything from scratch.
Please do a grass shader 🥺🔥
can we have imposter in unity shader graph as next tutorial?
it can be split into short series too
can be great for tutorial and learning lesson as well as useful for unity users
What CPU and GPU do you use?
I have a Ryzen 3900X and an RTX 4080.
How do you get HDRP version 15? Unity just give me version 12, it is cause you use Unity 2023? this is just for Unity 2023?
Yes, I'm using 2023.1 - the most recent beta version.
26:26 Unreal
Hi is there a way to contact you? or show you the effect, I run into some issues and don't know how to fix them
Hi Ben, do you know wether there is a way to have some kind of local volumetric fog which is not depending on the volumetric fog flag? like for light cones, to have the effect of them being volumetric instead of simple transparent cones etc. maybe this can be done with beer's law or another method.
Unity 2023.... omega oof. That kills me.
How can i use this fog to create a smoke effect. Billboards look ridiculous when player is moving
I think you need to use a particle system for that.
There is not Volumetric samples anymore in hdrp, there is other way to get it?
Is it somehow possible to use it with URP?
No, URP doesn't support volumetric fog, but you may be able to create something similar with a particle effect.