Ray Render in Nuke Tutorial | Compositing 3d Reflections

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
everyone this is just a quick tutorial on how to create a 3d reflection inside of nuke so this is not a 2d trick method that we can use to kind of create some fake reflections these are actually ray traced reflections inside of nuke so if you could just take a moment and hit the like button and subscribe as it really helps with the YouTube algorithm and you know supporting the channel and trying to get the started here the channel is pretty new I don't have that many followers or anything like that yet but you know I hope to produce a lot more content like this so if you guys could just take a second and just do that they'll be really big help for me so this is the effect we're gonna be creating we have a sphere here that's chrome and this is completely fake and it's inside of nuke we're not going in Maya or blender or anything like that and this effect is achieved entirely in the Ray render node inside the music so how do we do this actually the setup is not that complicated and I can actually provide you guys the project file if you want to have some assets to play with so I'm providing you guys with this footage here just a little kind of Astroturf area with a bench and then we have a sky picture and then we also have a 360 picture and just a picture of the opposite angle so I'm gonna teach you guys two ways to actually create this reflection there's a cheap way and there's kind of the right way and the reason I like teaching both ways is because you know sometimes you're in a pinch and sometimes you don't have all the rendered assets that you need or you might not have you know like a 360 picture like this so what I'm teaching you how to do is even if you don't have a 360 camera or you or you are receiving this footage from somebody else you'll still be able to create a reflection for those shots using these techniques using the kind of hacking compositing way and as a compositor you want to always be thinking you know how to get the result no matter what you have and being resourceful so that's really important so without dragging that on too long let's get to actually how to create this effect so what we're going to do first you need a 3d camera track so I've provided you guys with that in the script file so you guys don't need a 3d camera track this this tutorial is not about 3d camera tracking if you need to find that I have other information on that so if we just start with our shot here I'll just go over here so the track is here I've basically tracked this scene and I've placed a card on the the ground plane of this scene so again if you don't go 3d tracking I do have other tutorials out there for that but if we just look through a camera let's just merge this over so we can see and this plays a wireframe so I'm gonna put a wireframe shader just to show you guys that there is in fact a three-track scene here so this is just a the wireframe texture is it just creates this kind of you can see the polygons of your geometry and I'm just putting that onto the card that I've placed on the ground plane so that's what we're gonna start with we have a ground and a 3d tracked scene with a camera so what we actually need to do to make a convincing reflection is we actually need to project this footage onto the ground around the object that we're reflecting so if we look at our footage here we see that this sphere is actually you know reflecting the grass that's sitting on and everything around so all we need to do is we put that ground plane into 3d space and we're gonna reproject this plate that were filmed filming with so this this video that we're looking through we're gonna project that onto the the geometry so that's the first step so we're gonna create that card and that's been given so you guys start with a card next thing we need to do is we create a sphere so I put a sphere here and just put it into 3d space in the right spot so it's just a basic sphere and if I hit play here you'll see once we get it cassia's that this this video is kind of playing through it's kind of the caching is not that great in nuke when you're playing it for the first time but you see that the video is rotating around and projecting that image onto the card so we're just using the video a normal project 3d node we've hooked in our camera then we plug that texture into a card so now it's shooting that video out from our camera onto the card and the next thing we're gonna do is we want to put a reflection node on the sphere and the other thing that you do is a normal scan line render won't work for this so we're gonna delete the scan line render and I'm gonna create a node called ray render you guys might be familiar with this no one ready but this tutorial still gonna be useful for you because it's gonna teach you how do you mix projections and still get a reflection so if you guys already know how to use this so it's still useful tutorial I think so we're gonna plug in a ray render node and we're gonna look through that result and what we can see already is if we actually see that this is already kind of working this effect is sort of already working we have a sphere that is reflecting the ground around it so we can see that you know if we just disable the reflection and enable it's actually ray tracing this reflection this is so the difference between the scan line and the ray trace scaling render is good for like elements and smoke effects and you know some lights and stuff like that but if you're gonna create a reflection or some actually physically accurate shadows you need to use the Rea render node so okay so we're already most of the way there but we want to make this a lot better and and something that's important about reflections is they need to be spatially accurate so if we if you were looking at this ball you would think that well maybe it would be reflecting more of this bench and this bench is right next to the ball so you know we should be seeing some of that actually in this reflection but the problem is we're projecting this entire image onto a flat plane so it can't accurate really this ball can't accurately reflect what's sitting next to it which is this this bench so what we can do is need to start building a simple model build of the geometry that sits around this sphere and we can do that just inside of nuke so we're gonna just expand this a little bit and I'm gonna create a cube node and just plug that in and I'm gonna scale it down because it's huge or seems kind of tiny so I'm gonna scale it down and I'm gonna set the divisions to one and one so I don't need the cube to have a bunch of subdivisions it just makes it harder to grab inside of nuke sometimes and what I'm gonna do is I'm gonna plug the same a project 3d node that's giving our our car to texture I'm gonna plug that straight into the cube as well so now that image is being projected onto the card and onto the cube so if I move the cube around you see that the texture is changing that's because we're not applying the texture as a texture to the cube we're applying as a projection so that just imagine that that video is starting in the camera and being projected out and it's it's wrapping around our our geometry so our goal with this is we need to kind of line it up with where it is in the real world so the easiest way to do that is to look at the projection and and line it up to the ground plane so if you look at where this thing starts on this flat plane it's right here on this card so all we need to do is take the cube and put it put the front of the cube on the front of the real box here I'm going to line it up and just slide it over until you start to see that the box lines up so something like this and I'm just gonna keep moving it and you see there's still you know a little bit of an edge here on the ground you see how that edge doesn't line up with the cube so we know we just need to like rotate our cube just a little bit so I'm gonna take the cube and just rotate it into Y so I'm just slightly rotating it so if you look at this edge as well you see this is the if we look at the footage this kind of curved wire is the edge of that cube so in our 3d we're just gonna take it and rotate it so that that edge lines up with our fake edge so I'm gonna rotate it like that and just line it up here and one thing we can do is to also make this a little bit better is I have a lens distortion though it provided two guys as well and we're gonna undistorted that's coming in so that's just gonna help a little bit with and there's very little distortion on this so it's not gonna make a big impact but that is something that is kind of necessary depending on the camera you're filming with so this was fun iPhone this is very little distortion so next thing we're gonna do is let's just sorry my Wacom s up there a little bit okay so we got that cube lined up and we're just gonna shrink it in the Z a little bit so I'm holding command + Shift on a Mac to make sure that we have these scale selectors there I think I think it's could be ctrl shift on Windows but I'm just scaling that into place and making sure at the bottom of our projection that it's lined up and it doesn't matter if the cube is sticking through the ground a little bit you're not gonna see that anyways and then we'll scale it up until it starts to hit the edge of the wood so now if we rotate around you see it actually lines up with the real world so now if we scrub through we see that that kind of sticking that image is sort of sticking it's not a 110% you know it's not a perfect lineup but for the sake of this tutorial it's gonna it's gonna do good enough for our reflection so I'm going to copy the cube and I'm gonna do the same exact thing for the other side so I'm just going to copy it plug it into our scene and plug it into our project 3d and just slide this over until we hit our other little side of our bench here and that's we're gonna get yet something like this and lastly we're gonna duplicate that cube plug into a projection again and we're gonna move it up this time and scale it down in the Y and then scale it in our X and then just shift it over so we're doing is we're creating the top part of the bench and yet nuke some transform tools still not the best they really need to fix it but you know they do not think it's priority but yeah so this is sort of close here you can see we're starting to basically rebuild our real world in CG all right this is pretty good so this is gonna give something to our sphere to reflect so we're basically building the CG world out just so that we can get a reflection of those objects in the proper way and since this is closer it's gonna reflect differently than something that's very far so if we just take a look at a ray render again and we go back out into the 2d close on this now we can see we start to see some of our pieces actually wrapping and being closed so if for example I take the sphere and I move it we're gonna see as it gets closer to that object it's actually reflecting it so if I put it really really close you see it's actually you know you can even put it inside of it like that and it's reflecting the edges which is pretty cool effect so you can do all kinds of stuff with this you could create you know even a basic window you can use the same technique and I'll show you guys that briefly after actual just show you right now it's very simple so the same technique you can take you know a plane or sorry a card and plug it in let's close everything just we can see we're good so we this is the same prints the same principle of what we're doing but a very very simplified version is just a reflection the card and then just taking another card I'm gonna take the actually sorry I'm gonna take this 360 picture and put on sphere it's that so let's take a sphere and we plug this picture into it and we'll plug that into a ray render just quickly you guys don't have to follow along with this one it's just to demonstrate the principle and let's try to see node and scale up that sphere so it's big and if we reduce the size of our card we're gonna see what's happening here so this is kind of hard to see so I'm just going to reduce the size so here's our little reflective card and here's our camera so that that's is automatically gonna reflect whatever is opposite of it so for your looking at this it's hard to see a little bit but this this card here is reflecting the the sphere around it so you understand if you have a 3d camera track and you have a window you can just stick a reflective card on that window and then put another image opposite of it so you could doesn't matter what image you use so if you don't have for example this 360 photo the place that you filmed it doesn't matter you can still do this and just take a different photo that looks like it would be something that would be behind the glass that you're filming so that's essentially the principle but we're doing a more advanced version which is actually building it out into the the actual spatial scene that it is so we can continue to build this I'm not gonna build out the whole thing I'm gonna switch over here to what I've already done so this is what I built out and I just put this little barrier here the wall you can even put the plant you see the plant is not built out here this little pot putt for the plants you could put a cylinder and you build it out if you want so that works for the foreground stuff that works for all this stuff around directly around and that's gonna give you a pretty good reflection as it is but the next thing we need to do is we need to give it something reflect in the sky so if we look at this what we've just done and we just look at the result we see that we have like a black sky there's nothing to reflect and so what we do is just any picture of a sky I just took a 2d picture and kind of graded it up and put it on sphere so if i zoom out look at that sphere this is all it is just straight on the sphere and I transformed it to kind of scale it so that's all we got and now if you look at the rate render we can see that we filled in that black with with the sky so this is the kind of like quote-unquote cheap version and this will get you if you don't have the the 360 picture or anything like that this is still gonna work for you and you can still get a reflection but I also did take this 360 picture so this is just better because this is actually gonna give us you know everything else that was actually beyond you know so we have our closed objects that we modeled so we have this like bench and we have this little wall here and everything but we have these really objects that are further away like the sky in the house and the chairs I don't want to model all those things because they're so far away from the camera but if you do have a 360 picture you can use that instead so I'm going to switch it over to that because that's gonna give us a better result so if I just take a look at that result you can see that's much much better result and if you want to learn how to take 360 pictures you can do it with any camera you know you can take an iPhone you can take an Android phone and there's a lot of apps even to take 3/6 of pictures and any of those are gonna work for getting a reflection map and you can plug that straight into your your sphere okay so this is working pretty well you notice that all these weird things are happening the background and that's just because we're kind of looking at the picture that we placed behind so what we want to do is we don't want to be our final image we don't want to kind of output through this ray render we just want to get the ball we just want to get the ball out of the Ray rendered so what we need to do is just off to the side create a scanline render I'll just do it separately but it create a scanline renderer plug it into the same camera and then unplug the object into the same sphere that we're wanting to keep and this this scanline renderer is just gonna give us an alpha of that ball and we can use that to mask edit mask it out from this ray render results because we don't want all this weird stuff and we don't want to reproject our whole environment we just want because that's gonna actually distort and blur our image a little bit I mean want to have control so what we do is we just mask that out and then we have just our reflective wall and this allows us to just a over B merge it over our image so here's our background and here's our gray rendered result that was we stenciled out and our maxed out and that's what we got we have a reflective sphere and lastly what we can also do is another technique so what we want to do also to makes a little bit more convincing we want to add what's called ambient inclusion and we can do this inside of nuke as well with the railrunner so if we just take a look at what that is it takes a second to process there so what this is doing is it's creating a contact shadow between the two pieces of geometry inside of nuke so that makes it a lot more convincing you see it before and then after we really feels like the more of an object is there so how do we create an ambient occlusion this is very simple so we can just take the same setup we did we take our reflective sphere the same geometry we used and just copy it and we copy our ground plane so we just take those two pieces of geometry and we plugged it into an ambient occlusion node so you can just type it and ambient occlusion and make sure you have it plugged into you know like a constant or something like that and we can just take a look at the result we look at the rate it takes a little bit of time to process that and again so you need to use the Ray render node for this as well not the scanline renderer if you plug in a scanline renderer this is not gonna work so the ray renderer is good for reflections and good for this ambient occlusion pass so this is pretty good result and the last thing we need to do is if I just go back to frame I'm gonna go back to the start from your frame 55 just to show you guys a problem that you might see so we see that our geometry divide so at the start frame here we see that our geometry is kind of ending here like the card is not long enough so we're seeing the edge of the card so either you can scale this card to be really really huge or you can just merge a whites constant underneath to just fill in that black hole that's in the back there and that's gonna allow us to to do multiplied so if we take if we didn't multiply it's gonna get rid of all the white and keep the dark areas and we see that that gives us our nice shadow effect and lastly what you can do to make it a little bit more realistic and you want is I did a luminance key of the highlights of the the ball we have the luminance key and I pre multiply that result so he just keeps the brighter areas of the sky and I did an exponential below and just screen that over just to get a slight glow on the surface of this chrome ball to make it look a little bit more convincing again if you were doing this for real and you want to do the full proper way of doing this you would of course need to make sure you have your lens on distort and lens the stored at the end of your Ray render to reduce or so that would be something that you want to make sure you do and also you would put grain here as well so you match your film grain to make this more convincing but this is just a quick tutorial on how to make make the reflection sparkly so that's basically it hopefully you guys enjoyed I'm gonna put the link in the description below if you want to download the project files and it's a pretty straightforward tutorial and the other thing I wanted to introduce you guys to is I have a website here it's called Gumroad comm slash compositing academy so if you type in this address gung comm slash compositing academy i have like a little email list building up that i'm gonna be releasing like much larger classes on my own website and kind of off to the side so if you guys want to keep up to date with that kind of stuff you know that would be great if you're interested so yeah that's basically it thanks
Info
Channel: Compositing Academy
Views: 17,866
Rating: undefined out of 5
Keywords: reflection, nuke, compositing, 3d, rayrender, ray render, raytrace, spherical, environment, map, projections, projection, tutorial, model build, model
Id: UQlTyaVKog4
Channel Id: undefined
Length: 22min 44sec (1364 seconds)
Published: Tue May 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.