Transcript for:
Blender 4.2: Ray Portal Node Tutorial

blender 4.2 is already shaping up to be a massive update with a lot of really cool new features including the ray portal node the ray portal node allows us to access portals within the blender Shader menu opening up the possibility for some really interesting effects and Illusions in this video we'll talk about the basics of what the ray portal node is and then we're also going to create this illusionary effect where as you rotate this Cube you can see into multiple scenes from different angles I'll also spend a portion of this video pointing you to some other tutorials that die deeper into the vector math and the complexities of the node if you'd like to go further after this tutorial but with that being said let's dive in all right to get to the good stuff we first have to kind of go through this boring example of how the a portal node works so here we just have a cube down here and up here we just have a plane called portal with just a regular Shader on it we're going to go ahead delete that default drag this out and add a portal and at first nothing cool is going to happen it's just going to look like a transparent shape but we can control the position and the direction of our portal here from within the Shader so let's show what that looks like let's go ahead here add a texture coordinate and then we'll drag off the object and add it to a mapping Vector node and then if we go ahead and plug this into the position you'll see that suddenly it cuts off and if we move around there we can see that we're getting this weird effect well the actual plane here is 2 m in the sky so when we unplug that we just see right through it but now we're altering the position so we're now we're telling it via the Shader that we are actually appearing at 0 m so if I was to bump this up to 2 m you'll see that it gets the same exact effect so we're actually kind of moving the position of the portal there you can see how moving up and down in the space there let's go ahead and set that to two and you can see that we can begin altering some of these including rotating the effects which can cause some glitches in some instances and you can see that we can move it around and you can see how very quickly this can become powerful likewise we can also change the direction here as well and get some pretty interesting effects now let's look at a bit more of a complicated setup just a quick shout out to my patreon I've been posting project files like this on my patreon and I've also been doing some kind of breakdowns and walkthroughs of my short film if you'd like to see that as well but let's get back to the tutorial now if you want to follow along with me you can so what we're going to do is we're going going to grab a plane here and we're going to bring this up on the z-axis and we're going to add a new material to it we're going to call that material portal one so if you want to recreate this effect this is a part of the tutorial where you'll want to follow along so you may want to make sure you have 4.2 downloaded we're going to grab that portal material on our plane there and what we can do is just delete that drag out the surface and we're going to add a rare portal now we're going to do some interesting Vector math here and I actually discovered this math node setup from CG matter who has an entire video diving into like how Vector math works with these notes specifically so credit to him for figuring out the setup for now let's begin kind of our node setup here so let's add a tangent node here we're going to change this to a UV map and we're going to select UV map now if you're following along with me the default UV map on the plane should work for you now what we can do is add a geometry node and we will duplicate that geometry node and set that down here and then what we'll do is we will grab that geometry node and we are going to do normal drag that off and choose cross product and that'll put it into the top node there of a vector math we're going to take that tangent and put that into the bottom there perfect now what we're going to do is drag off the incoming here and put this into a vector math scale perfect and we want to make sure that that is in the top and then we're going to do neg1 perfect now we can grab that drag this Vector off into a DOT product and make sure this is plugged into the bottom and then we're going to duplicate this one three times and you're going to plug that scale into the bottom of all three just like that then grab the normal from the geometry here and for the bottom one plug it into the top Vector of the dot product there for the middle dot product here we're going to take this cross product math node that we have and plug that into the top and then for this last one up here we're going to take that tangent and plug that into the the top now we have three coordinates that we can combine into a new Vector system so hit shift a look for combine XY Z and then you're going to plug them in top middle and bottom accordingly now we have all these that we can plug into the direction and right now you're going to see that not much here has changed quite yet so to finish it off and give us some control we're going to add a texture coordinate we're going to drag that object off into a mapping Vector node and they're going to drag that vector and put it into the position by default here it's going to give us a black result and that's because we are inside of this Cube we have here we could go ahead and move that Cube down and you can see how it's offset so this is now sitting at the 0 0 position so you can either move this up on the math node so that it sits above it but I prefer to leave this at zero and we're just going to move our Cube down so I'm going to come over here to the 3D viewport switched to the side view here and if we move our 3D cube down here we'll see that now appears in there and what we're basically getting right now is almost a one: one because we have the plane up here but according to the Shader it thinks that the plane is essentially sitting like this so now what we can do is grab this box right here we'll grab this top face here we'll press I to inset that ever so slightly and extrude down inwards like that and you can see that now we are looking into this little room just like that and because of that nice Mass Zone setup that we got from CG matter we can take this and we can move it anywhere and you can see that we can look around and we can rotate this and we can look into our little room there so now you can place whatever you want in this little room and create that Cube effect let me show you how I set that up a little bit more okay so now we have this right here called portal one let's name this plane here portal one just like its Shader name and then we're going to duplicate this plane and move it over on the X x axis so let's can name this one Portal 2 and you can move this wherever you want but just for a simple math I'm going to go ahead and move this on the xais 5 m so now this is positioned over here so let's go ahead grab this Cube down here I'm going to hit shift d and let's also move this one over five now let's make these different colors just so that we can make this for illustration purpose perfect so you can see that even though we've moved this plane over it's still positioned here because of the Shader so we actually want this portal here to view inside of this Cube so we will come to the Shader menu there and then we can grab this portal node here we'll click new let's name this Portal 2 and then we need to just move the position of our Shader portal over this cube right here and since we did that simple math of five we only need to move it over five on The X and now we can see that it's there so you can see just that shifting this just kind of moves it from from one to the other so if we move that there the portals are now positioned directly above these cubes so you can use each one of these cubes to build out your environment or your set or your scene and we can kind of create that depth Parallax effect let me show you how to use these planes and put them together so let's add a suzan mesh inside of these cubes just to make this a little bit more obvious we'll make one that way and then we'll rotate this one 90° so that we can see there different so now you can take these planes and then you can go ahead and use them to build your own Cube so I'm going to move these planes off to the distance here and I'm going to hit alt R make sure that the rotation set I'm going to rotate these up 90° on the X AIS then I'm going to rotate one of these 90° on the Z axis it's 90° there and then we can match these up here so that the verts are matched up there and then now when we look at these planes you can see that as we rotate around these planes we are able to see inside of our cubes so I showed you how to set up the Shader but you might be wondering how I went about creating a more complicated setup like this well let me show you it's actually pretty simple if I go into my top view mode here you can actually see that my Cube and the planes which I've already taught you how to set up are just sitting over here off to the side and then you can see out in space here I've imported my environments so rather than just filling up those cubes you can just import your environments or model or whatever you want to toss in front of those other portals and then just go ahead and move them around and rotate them until you get them somewhere you're happy so you can see here I have everything parented to the floor and I can just move that floor around until I get it at an angle I'm happy with and then I can go and rotate around to view in there so it's pretty simple just toss everything you want in front of those portal placements now as I mentioned I wanted to point you to some other resources to dive a bit deeper on this node as I mentioned earlier in the video default Cube or CG matter already has a video up on this I credited that and I'll link it below an incredible Deep dive into just the vector math of how everything works he does a really good job of explaining it another YouTube channel that always has amazing artwork is cartisian caramel I believe I'm pronouncing that correctly and on this channel there's already a couple videos up doing some really cool effects in particular I love this portal effect that's being done on the channel and there's already a couple other things as well they're live streams so they're just realtime walkthroughs of the process very cool stuff definitely recommend checking out this channel as well I'm really excited to see what you create from this so please tag me at Southern chotti so I can follow along