Unity3D: Creating Dynamic Atmosphere with Simulated Fog Noise Using Particle Systems!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right everyone this video comes to you as a response to a question that I received from the one the only Photon potato that is a great name I love that name all right the question is do you have any ideas on how I could mix noise patterns into a fog volume or code a simple volumetric smoke based uh on a noise pattern well my answer to you is yeah I can get you really close really close in fact the outcome will be what you see on screen which is the visual look and feel of fog based on an organic noise pattern however there's a caveat it's not a true noise pattern per se it's using the unity particle system and a PNG of a white wispy Cloud uh graphic so that's the technique that's the strategy we're going to employ today to get what you're looking at right here right now so uh let's dive in the first thing you will need is a particle Cloud graphic you can make your own in Photoshop you can search the internet and all that but that's a little bit of a headache I'm going to link to one I'm going to link to the specific one that I'm using in the show notes Let's uh let's go ahead and start from scratch I'm going to do so by deleting a few things from my project so I'm going to delete these out of the hierarchy I'm also going to grab these two assets and I'm going to delete them from my project window gone Perfecto all right so I'm going to join you from start to scratch I'm going to begin by importing the parking Cloud white PNG into my project and the very next thing I'm going to do is I'm going to create a new material here we are I'm going to name this material fall and this fog I'm going to change the Shader from the universal render pipeline lit Shader and this should work both in hdrp as well as in the built-in render pipeline I tend to work a lot in the Universal render pipeline so that's just where I happen to be today all right so I'm going to change this by searching for Alpha Blended and you'll see that we've got two options I'm choosing the first one and it looks to be yeah this looks great so let me show you what the other one looks like so you can differentiate so that's the first one this is the second one okay the second one looks like it has soft particles factor and a tint color you know what here's the thing I'm going to utilize the soft particles Factor so I'm going to use this Alpha Blended uh particle right here [Music] this is not the normal one I use but I'm going to use it because I want to play with that soft particles and you'll see why in a moment so first things first let's grab our White Cloud and let's drag it into the texture slot of our material and we're done with that so now in our hierarchy let's create an empty project or an empty game object and I'm going to call this fog container and inside this fog container and I'm right clicking on Fall container and coming down to effects and choosing particle system and you can see that the particles they're moving left to right fog usually moves in a horizontal direction right it wafts along the ground the reason why I place the particle system within the fog container into game object is because it allows the fog to through no extra effort of our home it moves it left to right let me show you what happens if you don't use the fog container so if I just go ahead and hide this for a moment and let's say I just create a particle system well you can see it's shooting vertically it's going it's starting low and moving upward so I could rotate my particles of course or I could come into these settings and try to find the right settings to get it to move horizontally versus vertically but you can see that we're already getting into extra steps and I like to avoid unnecessary work maybe it's a character flaw maybe I'm just expedient for the sake of my ego I'm going with the latter all right so here we are we have the fog we see the particles and we can tell that the particles are not very attractive they're just these uh soft white spheres that do not look like anything we would want so let's replace these spheres with our clouds so I'm going to close the particle system and I'm going to scroll down in the inspector to the bottom until I see renderer I'll open up the renderer and I can see that here I have a material and it's particles unlit the particle's unlit are the Spheres we're going to choose our uh our fog material and we're going to slot that in to our renderer perfect so now we can already see that we have uh little clouds uh wafting through the air so I'm closing the renderer I'm coming up to the top particle system uh I'm going to uh first things first we need to work with the speed so the start Speed is five uh if I change it to one they'll move a little slower and they move a shorter distance but we don't want all of the particles moving exactly the same speed and to the exact same Finish Line we want to see some variance so the way we do that is we come over to the start Speed we go all the way to the right to where we see the downward arrow and we choose uh random between two constants these two constants are going to be zero meaning some fog will just uh visibly appear in place and then fade away in place While others will move with greater speed say five all right so we also we can tell that all of our fog particles are identical in size so if we go to start size we can see that we have one we can change this to something like 10. so already you can see all right we're getting close we're moving in the direction we want to go but before we go much further if I move these back to say two or I think they were one look at the rotation like they're all we can tell that they're the exact same graphic just appearing everywhere so we can we've only got one PNG to work with so we can uh modify the rotation to fool our eyes into believing that there's a lot of different shapes going on so I want you to choose start rotation go over to the right and I want you to choose curve now you'll see at the very bottom of your inspector particle systems curve if you don't see this red line it might look like this all you need to do to open it up is simply click next to the name and I want you to grab these uh the starting point on the red line drag it down to the bottom and I want you to grab the right dot I want you the control point I want to drag it to the top so now you can see as you drag those around you can see that there's rotation happening there's less uniformity so we're done with that part let's close the particle system curve all right so we can now close the particle system and move on to emission now admission oh I'm sorry I also because I was making a point I need to re I need to put my size back up to 10. now for a mission we've got uh the rate over time which is the number of particles emitted every second we want to change this from say a 10 to let's try something like 40. and we're done with a mission see how easy that was now let's move on to the shape now the shape you can see as soon as we activate or open the shape pane we are shown the um the visualization of the emitter which is a cone we want to change the shape of the cone shape from cone over to box already that changes how our fog is emitted all right so with that said now what we need to do is we want our fog to be placed exactly over our plane so the way I'm going to do that is I'm going through two parameters scale and also I'm going to use the shape Gizmo editing mode so first things first I'm going to increase along the x-axis let's try something like uh five and I'm going to try five on the z-axis as well and then the y-axis is going to be the height of your uh fog so if it's if it's kind of low to the ground if it's not very tall you can leave it at one but if you wanted to uh to take up a lot more of your atmosphere very quickly you could of course include this to be something like 10 or even something like 50. so I'm going to leave mine at one because we're we're only working with two little spheres we don't need a lot of height so the last thing I'm going to do right here in the shape panel and you know what I'm going to uh before I work with the shape panel I'm going to grab my container I'm just going to center it onto my plane now I'm going to select my particle system one last time I'm going to grab the shape editing Gizmo and that places control points on the uh on the perimeter of the box so I'm going to just expand this a bit and I'm going to have this occupy the proper area that looks about right so now we have a box emitter perfect now you might be saying hey I can't really see anything and you would be correct so what we need to do to fix that is we need to activate the color of her lifetime so choose color over a lifetime and click on the white color field to open the gradient editor first thing I want you to do is place a control point in the center by clicking uh on the top and then move your mouse to the to either end and we're going to select the alpha and we're going to drop that down to zero we're going to do that from both sides what this effectively does for us is it tells that the the particle when it's first created to be invisible and then as like through its life it gradually ramps up until it's fully opaque and then it at the center of its life and then to War as it ramps down toward the end of its life it fades back to transparent now in the center you can tell we still don't see a lot going on so I'm going to grab the center control point I'm going to lower the opacity just a bit and this is to taste it's like building a recipe you you're building a fog that needs to suit your taste so I'm going to grab something like this it's still visible but it's um uh it's not uh it's not overly soaked so we're done with the graphic uh we're done with the gradient editor so now we can come in here and now we can just we basically created it now we're going to customize it to be uh more nuanced uh to fit our needs so the first thing I'm going to do this fog is moving a little too quickly for me um this is like fog you might see like emit it's almost like smoke uh coming off of like a like a large campfire or a bonfire um or a brush fire if we if we leave our Stark speed the first we remember we're working between two constants the first one is zero in place and we can take the five and let's say we just make it like a 0.3 that's better that's slower that's not moving so quick that feels more natural so we're down for that so the start color is white uh and now let's check I'm just going to play around and look at things so uh if we wanted to change the the color of the um the fog uniformly from start to end we can choose start color and we could just make it say red and there's there's a red fault however there may be cases in which you want the fog to start as one color and end as another or to appear to be a mix of colors uh all kind of fading in and out of one another that happens in the color over lifetime so we can choose the so the top control Point controls the transparency and the bottom control Point controls color so if I choose the starting color uh here let's say we just make it green [Music] and you can see all of our fog is green now but if I choose the ending control point and I change this to something like red you can see that now there's a mixture happening uh it's green it's red and it gives a very like uh unhealthy look so you might have that kind of need say it's a chemical plant say it's a um you have a smokestack from a factory and the smoke starts is one color as it's really hot then as it cools in the atmosphere it's another color and it looks more like a pollute you can do things like that using Color over lifetime that's not what we're looking for today so I'm going to move mine back to White or both control points and call that that so now we can move in and get in close and look so this is uh a little close now I did remember in the beginning when I was uh debating between the two alpha Blended shaders um this is a Shader that I have not worked with before but before I switch it out because this looks a little different than what we saw in the very beginning which felt more pronounced so what I want to do I want to select my fog material and it's got a soft particle factor of one and a tenth color a kind of gray let's start with the color first I'm going to move this to White already we can see this looks more like what we saw in the beginning perfect this feels I I like this Shader because it gives us the added control of the color tint now there's a soft particle Factor here what does the soft particle Factor do let's I want to point out why we might need this as I zoom out do you see where the particle systems intersect with the the ground plane you can see the lines almost um and the same is true on the cubes wherever the fog particles intersect with the cube itself you'll see these weird like these very pronounced there you go very pronounced lines so I think um I've done a lot of reading online but I've never found a very straightforward well-articulated answer to the problem of enabling soft particles um and what what enabling soft particles does is it's supposed to eliminate that hard intersection of a particle with geometry so that we don't get these lines so let's go into our um soft particle factor and let's just move this down and up I'm going to move it down to nothing and turn on our pattern or our particle okay so we see them so now I'm going to turn that way up soft particles Factor let's turn it up to like three it's as high as that goes no I still see them so there's a trick to soft particles that I do not at this moment have the have a really good answer for it um no one's been able to uh articulate it to me either but here we go you can see that you've now got an area of thought and if you want to change this area fog we can go into the shape emitter grab our control points and we can just move them around and now over time you'll see that it congregates over it changes shape so now we've got more of like a cylindrical uh length of area that we are covering this is a great way for covering an area in fog and having it be look organic which is really nice this is how I go about it this is the new technique that I have learned what are your thoughts and do you know anything about enabling soft particles for any of the scriptable render pipelines whether it's urp or hdrp within Unity this is creating fog that replicates an organic noise pattern without being a true organic noise pattern I hope that this was helpful for you I certainly enjoyed making this and I enjoy I enjoy learning so when you ask questions if it's right up my alley I'm like dude that is a skill set I want to pick up I really enjoy learning doing the research picking up the skill set and then coming back and learning the second time by teaching you I've I've often heard it said that you learn once by learning it yourself and you learn a second time when you teach it to others so that's really what this channel is all about my name is Rick Pearson please like And subscribe if you'd like more of this if you want to stay connected if you want to keep your Learning Journey going with you with unity let me know join me right here for such things ask questions in the comments and I I will do my best to answer every question that you propose if not with a proper video then certainly I'll leave a comment with instructions if I'm if I have the knowledge to share alright so my name is Rick Pearson this is Unity for filmmaking and virtual production and a little bit of game making because they're just kind of mixing in together these days and I love that that's exciting that's wonderful that means that if you you learn to do one you can kind of learn to do a little bit of all of them and that's as a creative individual that excites me so this is it for the video today thank you for watching I enjoy this and I will see you next time in the next video bye
Info
Channel: Unity Virtual Production & Filmmaking (HDRP + URP)
Views: 5,280
Rating: undefined out of 5
Keywords:
Id: 8pgi1TBGCKM
Channel Id: undefined
Length: 20min 43sec (1243 seconds)
Published: Thu Jan 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.