Placeholder Image

Subtitles section Play video

  • Hey guys welcome back to another blender 2.8 tutorial.

  • Today I'm going to be showing you how to do some camera mapping but also how to bake in

  • the textures from that camera projection.

  • So I have this photo that we're going to be using for this tutorial.

  • We have essentially what is a box and then a bunch of stuff in the background.

  • And the main idea is we're going to do some camera mappIng.

  • So we're going to have a camera over here.

  • And then a box that you know pretty much matches this box.

  • We are going to project this image from the perspective of that camera on to that box.

  • But then the new step is we want to have this box have any custom uv map we want.

  • So we can unwrap it however we want.

  • And then we want to bake the textures onto that uv unwrap.

  • So unlike the projection, here we're going to have a custom uv map and bake it on to

  • there.

  • So again, the first step is to do some camera mapping.

  • And I did cover this in a previous tutorial.

  • So I'm going to do it.

  • But I'm going to do it very quickly.

  • If you want the full details there is a link in the description to the full tutorial for

  • camera mapping.

  • But this should be pretty quick.

  • We're going to open up fspy to get the camera in the correct perspective.

  • Use this photo right here.

  • And then we just need to match up our x and y axes.

  • So I'm going to turn off dim image so we can actually see what we're doing.

  • We can have the y axis be along here and then the x axis be along here.

  • Which is going to be really easy to set up because of course we have this box.

  • So y axis.

  • I'm just going to grab this handle and hold shift to get this zoomed in perspective.

  • So again handlebar and then hold shift to get that zoomed in mode.

  • And then of course we need 2 of these so it makes sense to have one y axis going here

  • and then the other one going up here.

  • We know they're parallel because they're part of the same box.

  • So put one here.

  • And also put one, where is it?

  • Let me try that again.

  • And also put one here.

  • And then for the x axis same thing but in this direction.

  • Again I'm doing this very quickly because I did cover it before.

  • But I just want to make sure these fundamentals are still here.

  • Think it's important.

  • Put our other x axis over here.

  • Just like that.

  • And then once we're happy with this we can turn on our 3d guide and set it to xy.

  • Because you know x and y axis. xy grid floor.

  • And then we're going to take what's going to be the world origin in blender.

  • We're going to take it and then just move it down to the corner.

  • Holding shift so we can see what we're doing.

  • Ok perfect.

  • So when we import this into blender we're going to get a scene with this background

  • and then the world oriented correctly with this camera in the right perspective.

  • And then the origin is going to be in this corner.

  • So let's do file.

  • Save as.

  • And then I'm just going to call this projection.

  • And we're going to import this into blender.

  • So I'm going to open up blender and of course you also need the plugin which again is free.

  • All this is covered in the first tutorial.

  • We need the plugin to import fspy files.

  • So I'm going to delete this camera.

  • We don't need it.

  • We don't need this light.

  • And I'm just going to keep this cube right here.

  • So file, import, fspy.

  • And then just navigate to wherever you have it.

  • Ok so it set up our background.

  • It set up our camera.

  • And then you know the world origin is in the corner of the box.

  • So the first thing we're going to do is we're going to save with control s.

  • And then desktop.

  • And let's call this thing, let's call it bake camera projection.

  • Because you know this is what this tutorial is about.

  • We're going to bake the textures.

  • I'm going to go into our camera.

  • Go into camera parameters.

  • Background images and make this brighter.

  • So we can see what we're doing.

  • And then the first thing to do is to take this box and align it so that it matches with

  • this box.

  • So I'm going to take the corner, which should be this corner.

  • And put it in the corner of our main box in the image.

  • And luckily we have this set up very nicely.

  • So we can just g for grab.

  • Z axis and move it up by 1.

  • And then same thing for the x axis.

  • So g, x, 1.

  • All keyboard shortcuts are going to be up here.

  • And then g, y, 1.

  • And let's see if that did what we wanted.

  • Ya perfect.

  • So of course we need this to be wider longer and taller.

  • Which shouldn't be a big deal.

  • We'll go into edit mode with tab.

  • Select this face.

  • Again face selection with 3.

  • And then we just move this until it seems right.

  • So g and then x.

  • And it doesn't have to be perfect.

  • We can do a bit more aligning later.

  • Take this face and then move it down the y axis.

  • And then we just need to take this face and bring it up so it's using up the whole box.

  • So g and then z.

  • Until that looks about right.

  • And here you see the error starting to accumulate as we go higher and higher and higher.

  • You can see this little gap.

  • And we can just adjust this by grabbing from this perspective.

  • And just trying to fix that a little.

  • So no it's not perfect.

  • It's a bit of a slanted cube.

  • But honestly I think it's going to be good enough.

  • We can do a bit more correction.

  • Something like that.

  • So ya technically it's a slanted cube.

  • But this should be good enough.

  • So we are pretty much almost at the end of what was covered in the first tutorial for

  • camera mapping.

  • All we have to do is project the texture you know the background texture from this camera

  • onto the mesh.

  • So the way we're going to do that is we're going to select this.

  • We can call it, what can we call it?

  • We can call this thing original.

  • So this is going to be our original cube.

  • We can call our camera just camera.

  • And also one other thing is our background image.

  • Default when you export out of fspy it's going to call it something like this.

  • So I'm just going to call it projection image.

  • Just so we have some good naming conventions.

  • So in shading for our original cube.

  • What we're going to do is we don't need this bsdf.

  • So x to delete.

  • We're going to add an emission.

  • And this is going to be important later.

  • But we're going to do it with an emission.

  • Plug this in.

  • Plug it in like that.

  • And then if you do not have node wrangler enabled go to edit, preferences, add-ons and

  • type in node wrangler.

  • And you should have this on.

  • So make sure it's on.

  • And then one thing it lets you do very quickly is we're going to select our emission and

  • hit control t.

  • And it's going to give us all these nodes.

  • This node group we're going to move it back with g.

  • You can do it without node wrangler it will just take some time.

  • So we have texture coordinates set to uv.

  • Feeding into this mapping node which we're really not going to touch.

  • And then into this image texture.

  • And of course for this image texture we want you know the image we're going to project.

  • So we're going to use projection image which is already in there.

  • And you see that none of this is looking correct but that's because we didn't do any of our

  • projection.

  • It's just using the uv map.

  • So what we're going to do.

  • Let's go into lookdev mode.

  • What we're going to do is we're going to go into modifiers.

  • And then do the same thing we would have done before.

  • So originally what we would have done is done a uv project on our uv map.

  • From the camera.

  • And you see it's pretty much good to go.

  • We do have a bit of distortion.

  • Notice that the aspect ratio in this case is 1.

  • And that's because our image if we go into properties is 3456 by 3456.

  • So the aspect ratio is 1.

  • If you had something a bit more common like let's say 1920 by 1080.

  • You just divide the numbers and get your aspect ratio.

  • So in that case it would be 1.7 repeating.

  • And you just feed whatever number that is up here.

  • Into your aspect.

  • But in this case it is 1.