position maps

P-maps by Xuan Prada

P-maps or position maps are one of those render passes that can save your life sometimes. They are really useful for compositing artist, matte painters or texture artists. You can save a lot of time rendering p-maps out from your rendering engine and avoid those tiny changes in a 3D software to rely on 2D or 2.5D techniques.

I personally use p-maps for different purposes, let me tell you some of them.

To place cards or another 2,5D or 3D elements

  • This is the render that I’m using for this small article. Nothing fancy there, just a few cubes and a couple of direct lights. This image has been rendered in Maya and V-Ray but of course you can render p-maps with any other combination of 3D program and render engine.
  • As additional render passes for this image I got the “normal pass” and the “world position pass”. You probably know that there are three different p-maps: World position, camera position and object position. They can be used for different purposes but all of them have the same kind of information, which is position.

    As they name says, one is the position information based on the world centre, the second one has the position in relationship with the camera, and the third one the position based on the centre of the object.

    You can render out all of them if you need, but for this example I’m going to use only world position map. All the techniques shown here can be extrapolated to the other maps.
  • This image is an .exr with all the render passes embedded so you can easily switch between them.
  • This is how the world position map looks like.
  • And this is how the normals pass looks like.
  • Use a shuffle node to read the p-map. If you need to un-premultiply it you can do it before the shuffle.
  • Use a position to points node to read the p-map and convert it to a 3D view.
  • Now you can move around the scene like any 3D software. This is extremely useful if you need to place any 2,5D or 3D element, like cards for example. Cards are extremely useful to place matte paintings, animated 2D elements, etc. You don’t need to guess anymore, just place your card in the right position.

To re-lit completely your scene

  • This is how your scene looks like out from the render package.
  • As we did before shuffle the p-map.
  • Take a re-light node. Connect the rgb to the color and the shuffle to the material. Then tweak the re-light node and select the normals and the point position.
  • Finally create a camera node and a scene node. Hook them all to the re-light node.
  • Now create a light node and connect it to the scene node. Play with the light to re-lit your scene.
  • As we see before, you can use your 3D scene to place the light.

To add subtle lighting information (or not that subtle)

  • Use a p-matte node to input your p-map and to output the information to the alpha channel. If you play with the shape, position and scale you will see the information of your new light in the alpha channel.
  • Connect the p_matte to the mask input of a grade node and play with it to tweak the intensity and color of the light.
  • Use a plus node to add as many lights as you need.
  • Of course you can help yourself to place the lights using the 3D view provided by the p-maps.

To project through camera

  • Projecting mattes, smoke, or any other information has never been so easy. Use the 3D view and a 3D camera to project detail on to the current render.
  • You can create a new camera or import it from your 3D package.
  • Use a re-project node to connect the camera, the image that you want to project (in this case a grid) and use a shuffle node with the p-map to provide vector information.
  • Finally I’m using a merge node to combine the grid projection with the original render and it’s being masked out using the embedded alpha from the .exr render.
  • Of course you can use the 3D view to place or modify the camera.