Learn how to project an image onto a 3D surface with a camera.
- [Instructor] In a previous movie in this weekly series, we saw how to use the camera map world-space modifier to project UVs onto a surface. And in that situation we used the modifier in order to give us the ability to move the terrain around anywhere in the scene and still maintain the same mapping relative to the world. And that gave us a lot of freedom to setup the level of detail so that it's concentrated within the frame. Now I'm going to show you another usage for the camera map world-space modifier.
And that is to magically turn a 2D image into a 3D volume, that we can then move around. And in this case we'll use it to generate another eye view for a stereoscopic 3D image. That's a simple case application for this technique if you extended that you could actually make it possible to, in a limited extent fly around that 2D image that you've magically made into 3D.
So it all starts from a 2D image and let's go ahead and load that up in the material editor. Go to material editor and we want a material that does not respond to light, at all. We want to just, basically re-render the existing image with some offsets and we don't want any lighting or shading applied. So in the material map browser, under materials, Arnold, utility, let's create a map to material node.
Drag that over into the view, and double click it just to rename it, we'll call it projection. And the map to material node sole purpose is to convert a map to a material that can be applied onto a surface. Click on the no map button, and then in the material map browser double click on bitmap, in the current project's scene assets images, scroll down until you find your image and that's an image that I created in my favorite 3D fractal rendering program, which is called Mandelbulb 3D.
Click open, and that's our shader, it's very simple. We just need to now apply it to all of this geometry. So select everything in the view, I've selected the camera here but that doesn't matter because it can't accept a material anyway. And go ahead and click assign material to selection and in order to see the bitmap in the viewports, select the bitmap node and activate show shaded material in viewport. Once we've done that we can close the material editor and in our perspective view we can see that there is a material applied and it's just using the default UVW mapping that came with these primitives.
Now we're ready to apply the world-space modifier to these objects. We want to select the objects but not select the camera or its target. So let's go to the scene explorer and select everything with the control key, except for the camera and its target. With those six objects selected, go to the modify panel and from the modifier list apply camera map world-space modifier. Once we've done that we need to assign the camera.
Select any one of the objects so that we can actually see the parameters in the modify panel. Then click the pick camera button, and click the camera either in the viewport or in the scene explorer. And once you've done that, you can see that the mappings been applied and it looks a little bit strange. Can zoom in on there and we can see how it's stretching in weird ways because the UVs are being projected from the camera. Let's load that camera into a viewport, I'll close the scene explorer, go over to the top view, and switch that over to cameras, phys camera projector.
We want to crop the viewport to the renderable area and that's the show safe frames option, the keyboard shortcut is shift F. And we also of course want to see this in shaded view, and the keyboard shortcut for that is F3. So if look at this in the physical camera view here it looks very similar to the original image. Our grid is being displayed here too. I can turn that off with the G key. And we are seeing some shading here on these primitives, but if we actually do a rendering it will look very similar to the original 2D bitmap because again, the UVs are being projected from the camera point of view.
And the part of this that we're not doing in this exercise is the meticulous arrangement of these primitives so that they line up with the 3D scene that we want to emulate. In other words, whether this is a fractal rendering or a picture from the real world or stop-motion animation or whatever it is, it was originally 3D somehow. And once we've created these primitives, applied this material and projected the UVs from the camera point of view, we can manipulate those primitives with any tools we want, move, rotate, scale or in this case I've applied a taper modifier to once again, try to match the original 3D scene, whether it was in the real world or not, so.
Ya know, I can move these around and try to line it up so that it looks, ya know, the same way it was in the original scene. Okay, I'll undo those movements with control Z. So we've got that now and we can in fact render this as it is. So I can go over to the physical camera projector and let's do an active shade and render. Go into the render setup and switch that over to active shade and click the render button and we see that, as I said it looks very very similar to the original image.
Okay, cool. Now, the fancy part here is to create another camera so we'll have a left and a right eye view to create a synthetic stereo pair, very cool stuff. And this is in fact how it's done when a movie is shot with a single lens and then magically converted into stereoscopic 3D, this is the essential workflow that's followed to do that. All right, cool, so we need another camera for the other eye. I'm going to arbitrarily say that the existing camera is the right eye, and I'm going to create a left eye.
Notice that I'm using a target camera, and if I tumble around in the perspective view here, you can see that the target is positioned basically in the middle of the composition here and that's going to be my point of convergence where the stereoscopy converges. And so, anything in front of that target is going to look like it's popping out of the screen and anything behind that target is going to recede into the background. all right, cool, so I'm going to create another camera, select that phys camera projector, get in really close because the interocular distance, or the distance between the two eyes is going to be pretty small.
We don't want a giant divergence between those two. So let's make a clone, and although the camera is lined up with the world right now, it might not always be that way, so you might want to do this in local space. So with the move tool active change the reference coordinates system to local. And then hold down the shift key and drag over in the X axis to make a duplicate. Release the mouse, and we can make it an instance so that if we make any changes to the camera it'll ripple through both of them.
And for the name I'll call it phys camera left eye, and click OK. Now I've got another camera, and I move the camera but I didn't move the target. They're both pointing at the same location because the target hasn't moved. And we can verify that we have two different views here. Let's load the left eye into this other viewport here, click on front, go to cameras, phys camera left eye, shift F to turn on safe frames, F3 to show it in shaded mode, and at this point I've got the right eye on the left and the left eye on the right and I can actually free view this.
If you're used to that you can cross your eyes and actually view this in stereo. I want to get these a lot closer to one another to do that. And if you just cross your eyes you can actually see the stereo at this point. all right, cool. But, it's probably a good idea to actually render this out. And actually we can demonstrate that there are two different views with the active shade renderer. So we can click on active shade and we're rendering the left eye now and I've set it up so when I click on the other view we get the active shade updating.
So you can click back and forth between these and as we do that we can see that the view is changing and it's as if this whole scene is pivoting or rotating a little bit. If we want more stereo or a more exaggerated effect we can just move that left eye. So get in closer on that, maybe select that camera press the Z key, it's going to zoom out a little bit but we can move in manually. Get in real close on that and move it over just a little bit more and as you do, be careful that you don't actually reveal what's going on in the backdrop there, that's not going to work very well.
So, and if you're not sure exactly what's going on you can go back to active shade, can enable active shade and enable the left eye view just by right clicking, and then we can move that camera with the move tool, and we're moving it in X, so we can go down to the transform type-in dialog here and move that camera around and we can see how it's updating in the active shade view. And we're seeing that issue with the backdrop there. So we just want to around so that we maximize the amount of stereoscopy with the amount of parallax, without, ya know compromising the composition.
You don't want to see that little bit of garbage there. All right so, once we have what we want we can close active shade and we want to actually render these using the production renderer. And I've already done that so, we'll skip that part. I'll show you have to put these together in Photoshop. So I'll minimize 3ds Max, got Photoshop already open. Go to the file menu and go to scripts. Load files into stack, click browse. And we want to load up the renderings, and those are going to be found in the current project, render output, examples, camera proxy.
Select both of those and click open. And we don't want to align or anything like that, so click OK. And now we've got a Photoshop document with two layers and the left and right eye are separate layers here so we can disable visibility on left eye, turn it back on and off again and we can see the parallax. And we can make this an anaglyph stereo rendering by right clicking on that top layer, which is the left eye and then go into blending options, and simply disable the red channel, and click OK.
And now we've got a color anaglyph stereo image that we could view with a traditional red cyan glasses. And that's how to create synthetic stereo from single lens mono scopic image by projecting the image onto proxy geometry with the camera map world-space modifier.