Unity VFX Graph - Holographic Map Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today unity is sponsoring this video more about them in a moment and this time we got something out of a sci-fi game really cool stuff and it's a holographic map [Music] this was the most voted project by my patrons so here we go that's what we are going to see you can find this project there in my patreon page and many others as well links below and it's quite technical but i'm going to try my best to explain you how you can achieve this we are not going to use a point cache we simply need a camera [Music] this works really well with the terrain and i also test it out with this city that i found in the unity asset store and the result is actually not that bad [Music] so yeah i got it from the unity asset store which from time to time has some crazy sales and right now they have the new year sales going on where you can get a assets for your game and improve a lot your projects i left some links below so make sure to check that out plus i have a super special discount for you where you can get an extra 10 percent off of your next purchase so make sure to use it when you are checking out so there's two way we can do this one is with a point cache where you assign a particle to each vertex of the mesh and every time something changes you need to bake again the point cache but there is a second method which is literally recording the scene capture with a camera a certain area then according to the image the camera would output we could assign particles via rgb values which is exactly what we have here and as you can see if i move the camera the terrain the vfx graph will update automatically which is pretty cool so that's where we are going to start by creating a camera that can record the scene so with right click in our scene let's create a new camera i'm going to call it camera underscore render texture i'm going to reset the transform and push it up into y 35 units this is basically the moment where you place your camera on top of whatever you want to create an holographic map from and rotate the camera 90 degrees if i turn on the gizmos as you can see the camera is perpendicular to the ground to my scene which is a basic terrain and now we can increase the field of view in my case around 120 seems to be fine and then down here in the environment for the background type we want the solid color a black color and as you can see we have an output where we can assign a render texture and that's basically where the magic starts if we go to one of these folders and we right click create a render texture we can rename it to render texture underscore terrain for example and up here we can control the resolution of the render texture but we are going to leave it at 256 for now what really matters is that we assign the text to the camera we just created to the output texture and it's outputting to this render text it's low quality because of this color format it's in 8 bit the rgb goes all the way down to rgb 32 where you can have the most quality but for now i'm going to leave it at rgb8 and by the way as you can see we have this rgb channels and this is what really matters to us to create holographic map so now if we create a vfx graph with right click you can rename it to vfx graph and scar holographic terrain if we drag this to the scene i'm just going to push it up in the y and then i'm going to press the edit button to open vfx graph and let's see how we can use a render texture in here so we need to first have access to the render texture right so let's create a public text 2d property where we can assign exactly that the render text but how do we use this well in some ways it's similar to how you would use it in shadowgraph you need to sample this text to have access to its information if we drag a line from here and search for sample text to 2d we will find one but we need the uv coordinates now let's make something clear the coordinate of this point in a texture is one one and this point down here is zero zero so x and y are from zero to one right and we want to create random coordinates within those values so we can assign a particle to it and there's a very interesting thing we can do initialize particle by the way we can remove this set velocity which is create this custom attribute in the inspector we can name this attribute which is very important you can name it particle random position and we want this to be a vector 2 so we can create a random values between 0 and 1. so let's set the random to uniform for now and we just need to say the minimum of the x and y is zero and the maximum is one and boom we have a bunch of particles with a random vector two from zero to one now we can use this custom vector 2 this custom attribute with a get custom attribute we just need to make sure that the name is the same exactly the same and with the same attribute type which is vector2 and we can pass this to the uv input of the sample text to 2d but if we were to use this in a set position nothing would change and that's because first we need to tell each particle that their new position is going to be somewhere between that random 0 and 1 vector 2. we can copy and paste this get custom attribute from there we can create a new vector tree where the z is going to be zero if we fit this to the set position now we see something different happening if you look closely they are being placed according to the uvs of a square but only diagonally and not randomly as it should be because of one simple thing because the set particle random position is said to be in uniform mode instead of per component as soon as we change it we get particles being spawned in a square oh and by the way lifetime doesn't need to be random and we can leave it at one second for now let's take care of the aspect of this really quick down here we can say it's additive and for the main text we can use the default particle that comes with unity it's more than enough you can also control the size really quickly with the set size and create a property for that we can call it the hollow map particle size 0.01 maybe that's too small but if you have noticed nothing changes because set size over life is set to over white instead of multiply now for this curve we can say it goes from big to small something like this is enough and yeah they are really small so 0.05 okay i mean we don't need to fade them away and let's crank this up the particle count first the capacity to to 100k and the rate to 1000 for now and by the way you can create the property for this so you can control it inspect or a float and all a map particles break for example okay so now that we have these white dots you can better understand what's happening and as you have noticed by now they are forming a completely square shape which is a good start because that's the boundaries of a texture let me just push the set lifetime up here real quick because now we can use a dataset position they go out to zero because they need to know their previous position so we can use a git attribute position and if we add to this the information that comes out of the texture of the sample texture you may not notice but they are spouting according to the pixels of the texture what we are missing here is the use of the color that comes from the texture the rgb values we can do it with a set color before or after and connect what comes out of the sample text to 2d and as soon as we do it as you can see they are barely visible because most of the things are far away from the camera but if we increase the rate now we are able to see what the camera is recording let's just rotate it minus 90 degrees in the x and if you look closely it adds some thickness but we need to increase it we need another set position we can once again use the get attribute position and add more information to this in this case we only want to have set to z so we can create a vector3 pass the information from the x and the y and for the z we can multiply it with a property with a float we can call it the holomap z scale default value of 1 and connect it here to the z of the vector3 and then pass this information to another set position block nothing will change because if we go to inspector now if we start increasing the z scale here we go we get some thickness it's very dull because we haven't yet increased the intensity of the color we can do it with a set color down here in the output particle quad set the composition to multiply and add the color property the auto map color for example the rgb and a to one connect it down here and now in the inspector we can go ahead and increase the intensity for example i'm going to leave it that white but you can choose whatever color you want of course anyway this is the first and most important part the basis of the holographic map from here you can do a bunch of things for example if you want this to be static instead of always spawning particles you can go ahead and create a burst of particles disable the constant spawn rate disable the set lifetime and down here disable the multiply size of our life and since they don't have a lifetime they will live forever and they will always stay in the same position alright so but i'm gonna still use the constant spawn rate so if you move the camera it will continuously update the holographic map you can also increase the lifetime and you will have a much more dense map of course because particles are living longer anyway now let's move on to the next part where we create some projectile lines so first let's create a group for the log graphic map then we can copy and paste this with ctrl c ctrl v and let me just disable here the constant spawn rate this is for the projector lines 1000 for the particles is enough and most of the magic happens down here in the output you can use an output particle line and they have a target offset that we can play with let's first remove this output particle quad and from here now we can get the position of each point of each line multiply it by -10 for example and then add another vector3 where the x and y are going to be five connect this result to the target offset and since we are offsetting the target to the center now the z will control how high you want these projectile lines to be and they are completely black because it's in alpha mode we can set them to additive and here we go we get a really cool result from here you can then obviously use a set color change it to multiply and you can choose another color for these if you want or create a property as well and then you can create a few more properties control these values of course what really matters from here is if you look closely you will notice that from time to time we see a point in the middle of nowhere and that's because the camera is rendering our holographic map so it's very much advised to set the layer of the holographic map to something else besides the default one like transparent effects and then you can go to the camera and in the coloring mask drop down menu you can disable transparent effects which is where the holographic map is and as you can see now you will have no longer floating points out of nothing now the cool thing is that we can create some scanning lines we just need to copy the holographic map 1000 for the rate is enough these are for the scanning lines by the way which is very simple it all happens up here when we create this random vector to the particle's random position if we set the minimum y to 1 as you can see we have a line on the side of the map now what if we could animate it and we can we can use a sample curve for example we can use this graph but the opposite the first key is one the last key is zero we can connect it to the y of the minimum and the maximum now we just need a way to animate this true time right and there is a time variable that we can use which is called the total time vfx but we need to slow it down we can multiply it by 0.1 oh by the way this is where you control the scanning line speed and we may not see it very well but it's there let me just change the color to something like blue and increase the intensity really a lot so you can see it and here we go look at this really awesome stuff and you can control the trail by playing with a lifetime oh and as you can see the line stopped right there that's very simple to fix if we go to our sample curve in this right cog we can choose ping pong instead and once it reaches the and once it reaches one of the extremities it goes back and it keeps on going on just like this you can also switch to loop if you want a different feeling now there's a very simple trick we can do which is add a periodic burst to the spawn a count of 250 is enough and if we set the delay to 0.3 or 0.5 as you can see it will leave a nice trail of lines behind and it really adds a nice touch we are just missing one thing right we are missing the projector lines the blue projector lines to complement the whole idea of these scanning lines right so it's very simple to do it we can copy the projector lines once again and the changes are going to be the same for the scanning line which is basically animating the y value of the particle's random position vector 2. you can copy from here ctrl c ctrl v connect it to the y boom caraboom here we go we have some projecting lines following the blue ones oh yeah we just need to set the color to match the blue here we go look at this it's really awesome we have a really nice result this method works really well with a terrain but i'm sure this is a really nice starting point for you to create something awesome to improve this and make it look even better if you want to get your hands on this project and support the channel this is all available on my patreon page and there's plenty plenty of assets there that you can get i want to take this moment to appreciate each patron that supports me and as usual a special shout out goes to the top tier patrons which are elac frosts bradford errant groupie dubidu daniel hatchcock david duck david might lars derek benson donald thompson edward chai eric edson ft92 goblin black leonard fresh little tsai maxim mograph tech nat sims oitsk radioactive bullfrog revenant games stefan zarkov very soother sonan chin and ingo das really appreciate the support guys i hope you have enjoyed this video to everyone who watched please like and subscribe and i really hope to see you in the next video as well so thanks and bye [Music] you
Info
Channel: Gabriel Aguiar Prod.
Views: 45,801
Rating: undefined out of 5
Keywords: Unity tutorial, vfx, vfx graph, vfx graph tutorial, unity, visual effect graph, unity visual effect graph, unity vfx graph, unity visual effect, tutorial, shader, shader graph, unity shader graph, unity shader, fx, graph, map, unity map, map tutorial, unity holographic map, holographic, unity holographic, unity scifi, sci fi, unity sci fi, visual effect graph unity, vfx graph map, vfx graph holographic map, holographic map, sci fi map, futuristic, unity futuristic, futuristic map
Id: 1BVRN_TP4m8
Channel Id: undefined
Length: 17min 38sec (1058 seconds)
Published: Tue Dec 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.