Simple Parallax in Blender 2.9

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay let's actually create one of my absolute favorite effects uh when it comes to materials and shaders which is this parallax which basically fakes depth on a texture you can probably see it even better over here where we just have a few points and as they move it seems like there is something deeper inside the texture if you look at this like voronoi here it's like there's something behind the individual lines like the copied over here or even here where it's looks like there is some kind of mist or nebular behind this plane so making the creating this material is actually fairly easy um it's just a little bit unconventional so let's get right into that let's just create a new don't need to save here just go into a completely new completely fresh blender file just delete everything with a and x and then we're gonna add a point i like to go over to the shading space usually go into rendered view i like to select a nice world color nice and dark yay all right let's create a new material for our plane delete our bdsf over here and let's just add some kind of placeholder uh texture i usually like to go for just some voronoi and there we go we have a nice and colorful oh let's put that up a little bit something like this yeah i like that alright so our first goal here is to give us the effect that the surface or texture here is going into the depths which means when we basically look around the plane it kind of moves based on from what angle we look at so what makes this material so unconventional is that we actually do not start with texture coordinates here but we're actually starting with the geometry node and we're gonna add a it's on the vector i think yes a mapping and we just put that in here and then everything disappears but now we're going to use the position of the geometry node and put that into the vector and that basically creates um a mapping based on the geometric position on the object which brings back our texture again so to move this mess of colors over here based on our view angle we actually use the incoming over here and put that into the location and when you now move around you see all kinds of stuff happening it looks a little bit like how we want it but there are a few problems first of all the cells seem to like go all over the place and that's because we're using a 3d texture but for this effect we actually need a 2d one so now if we look around it kind of looks like what we want but something's missing and that's actually depth so right now it's just seems to be moving but it's not very convincing so to add depth we can simply multiply with a vector math note where is it multiply multiply there it is and then we're going to multiply that by a value or very specifically a negative value if you like lower this now you will see the whole thing seems to like lower into itself and when you look around now it's doing it it's doing the thing we want if we go even deeper here seems like to be farther away and it seems like it's already working but it's not actually because at the moment we just have this completely flat plane but if you actually start to rotate it something happens something we do not want it stretches if you look around it seems really weird and oh my god what is happening so what's basically happening here is if i um turn this away is that this projection currently works only in world space and once we actually start rotating our our plane the projection basically happens from the z coordinate so from up and down and as we basically go parallel with the z here it goes all sorts of crazy so we could simply fix that by um changing from world space into object space so we could go into vector and then vector transform and simply set that to point so it sets from world to object and now as we look around when we turn this around it basically does what we want and you could stop here and just call it a day this is a parallax that looks fine but there's a different problem now if we actually add a cube and put this material on this cube now we have this problem it's still it's still projecting from the z um but now an object space so object space is also isn't quite what we need for this to work so what do well first of all we get rid of this vector transformer what we actually need is a space that is based on the normal of our objects or more specifically on the tangent of our object which basically is the quote-unquote 3d space our textures reside in and to do that we need to use a little handy-dandy uh math calculation we basically have to construct a tangent vector now i'm not going to bore you with uh like with math equations and anything like that so i'm just gonna build the notes for it and you can follow along um if you don't want to do that there is a little link to a gumroad uh package that you can just download and use a little note group that i built for you so you can just use that if you want but if you want to stick around and follow me that's even better alright um so for tangent space what do we need so we can actually if we look here we actually have a tangent node here and since we want to basically use a three-dimensional one we actually need to use the uv map which means this effect will only work if your objects are uv unwrapped so if if you use this and nothing happens it's probably because there is no uv map on your object now we need to construct a vector which means we need to combine x y and z and we need exactly four math notes to do this so if you're going to come out here math wait no not math notes i'm not i'm sorry i mean vector math notes actually and more specifically we need dot product here so our first dot product over here now that we need this mapping node put that into here and the tangent and this will be our x value now for the y value we actually need two of these with the first one being a cross product and that cross product will be between uh our normal over here from architecture note we use the normal and again our tangent space and then we plop that into the dot product over here and use again our mapping form over here and that will be our tangent y and for our tangent z we just need another dot product over here which will just be the mapping over here and the normal again [Music] there we go and that will be our z and that's already our tangent space build up so now if we just put that in here it looks like this and now if we add our cube back and put on our material it's working hooray thankfully all the um primitives from unity already have a uv map so you don't need to worry about that um but yeah so this is basically a very simple very common way of just having some fake depth in your textures so what you could do with that now is if we take that voronoi and we put on let's say a math over here and then we use a greater than and then we maybe do something like this so we only get like a few of these and then we lower randomness so we get like little little pixels just moving around we can up this scale like this so we have nice and easy over here and let's put this a little bit closer so it's like let's say minus five cool cool to get like some extra depth into that all we need to do is take take all of this all of the stuff we just did and just duplicate it and then we go over here to our value making it a little bit lower let's say -1 is good and then over here just duplicate another math and go to add maybe clamp and then just add these two together now when you look around there's like an extra layer if you look at this it's like an extra layer down here and if we just up the scale a little bit maybe we can make that a little bit more extreme something like this so it looks a little bit more deeper and then we can just do that again we just take all of these duplicate them change it over here so it's maybe minus 3.5 and then up the scale a little bit and then add that again to what we have oop get even more death more pixels more stars you can use that to drive all sourds of very very interesting effects all right so now that you know how that works i hope you create some really really cool effects um like i said there is a little gumroad link in the descriptions if you just want to grab the note group for this um if you want to know just because i just remembered you can actually put a little wait actually let me we just control these until we only have one layer left there we go so if you want to like offset your your individual layers just in case there is some kind of weird repetitions that you don't want you can simply add a another vector math i'm sorry no not a vector math we want a regular math note you can simply add to basically give yourself like an offset here and the same over here or the other direction so we get the two directions all right well that's it from me i hope you have fun with this one and i see you guys next time bye
Info
Channel: Feline Entity
Views: 11,131
Rating: undefined out of 5
Keywords: blender, 3d, parallax, effect, bnpr, npr, cat, stars, depth, tutorial
Id: iSQGp6zHdyM
Channel Id: undefined
Length: 13min 41sec (821 seconds)
Published: Mon Oct 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.