Quantcast
Channel: MintViz Workshop » V-Ray
Viewing all articles
Browse latest Browse all 18

Autodesk 3ds Max and Vray camera matching – Part two

$
0
0


In part two we will be looking at how to light the scene once you have camera matched it to a photo, commonly known as a back plate. In case you haven’t read the first part of the tutorial, you can view it here. Please note this tutorial will not cover materials. The materials have already been created and applied.

To correctly illuminate the scene, a HDR image will be used as a light source as well as a reflection. A HDR image is made up of multiple exposures of the same image allowing a greater dynamic range of luminance between the lightest and darkest areas of an image. Typically they are created from multiple RAW images taken with a digital SLR camera.

On this occasion I have considered an alternative method for creating a HDR image. I chose a method that would far suit a more everyday situation, where taking your digital SLR camera with you might not be practical. The HDR image will be created using the iPhone 4 with a lens attachment and a bit of Photoshop trickery. However if you do have access to a decent digital camera that can shoot multiple exposures and a fish eye lens, you can skip to generating the HDR image but miss out the manual EV override section.

The lens

The purpose of the lens is to capture a full 360° spherical panoramic image that can be mapped as a spherical environment inside Autodesk 3ds Max. If you were to take a regular panoramic picture it would not wrap correctly as an environment and the lighting and reflections would be incorrect. The lens that I will be using is a 180° fish eye lens sold by Pixeet. You can find out more information and purchase it here. What you get is a silicone case, 180° aluminium and glass fisheye lens, front and back lens cover, self-adhesive metal rings, and security strap. The lens is attached to the silicone case via a magnet so there is no actual, permanent fixings to the iPhone itself.

Taking the photo

For best results you should mount the iPhone on to a tripod to keep the camera steady and in the same location. Put the silicone case on the iPhone and then attach the lens. With the Pixeet app installed and running, select new panorama and the 360° degree option. You take 4 photos each time, turning 45°. If you are not using a tripod, try and keep the iPhone in the same spot as you rotate, otherwise when the software attempts to align the 4 images they may not line up correctly. This is not a huge problem as this map will be used for light and reflection and therefore it would be difficult to notice any seams where the images do not line up correctly. The application has a built in cross hair function that turns green when the iPhone is level, this is very useful if you are not using a tripod.

Preparing the images

HDR images are commonly created from RAW files, each holding different exposure information. Because we only have one image to work from, it would be impossible to extract information that does not exist. What we will do instead is adjust the image to recreate a range of tones and then composite them together to create the HDR image. This process is known as tone mapping. The results are not as accurate as using multiple RAW images but it is good enough for the purpose of this tutorial.

Once you have downloaded your spherical panoramic image from your Pixeet album, open it in Adobe Photoshop. You will notice that there is a black area at the top and bottom of the image, this is to cover up any bad seems when mapping it as a spherical environment. Using the clone stamp or the content aware fill tool, fill in as best you can the black areas with the surrounding environment but don’t worry about being accurate. We just don’t want the Pixeet logo in our reflections.

By default EXIF data is stored within a JPEG image. This is information such as ISO and F-stop and you can view this by right clicking an image in Windows Explorer and going to the details tab. Because of this data, Photoshop knows that this image is the same image even if we adjusted it. It will flag an error when attempting to create a HDR image saying that the images chosen are of the same exposure.

What we will be doing is tricking Photoshop into thinking the recreated images that were tone mapped now have different EXIF data. To do this the image needs to be saved as a PNG as this file type does not store EXIF data. Once saved, re-open the PNG in Photoshop and add a curves adjustment layer and click and drag the centre of the curve so that the input value is 128 and the output value is 0. Save this as img01.png.

Now increase the output to 64 but keep the input at 128 and save the image as img.02.png. Repeat this 3 more times by increasing the output by 64 each time. The final image should be image05.png with an output of 255. You will end up with a set of images that have an exposure range between pure black (0) and pure white (255).

Generating the HDR image

In Photoshop, choose file, automate, and merge to HDR Pro. You will be asked to specify the source files. Select all of the 5 PNG images you just created and click OK. Photoshop will start importing the files. You will get a warning pop up saying that the images may have been taken with different cameras and you will need to manually specify the exposure information by adjusting the EV value. Input the following:

  • Img01.png = -2EV
  • Img02.png = -1EV
  • Img03.png = 0EV
  • Img04.png = 1EV
  • Img05.png = 2EV

Once the merge has been completed a new window will appear allowing you to adjust the final output of the HDR image. HDR images are best set to 32bit floating point. This way the image will hold as much information as possible. Make sure the mode is set to 32bit and you will notice there are far fewer options than if you were to use 16bit. You can control the intensity of the HDR image but it is best to leave it at the default and control it in Autodesk 3ds Max. Click OK and save the image using the Radiance format.

Creating the ground plane

Open Autodesk 3ds Max. I will be continuing on from the previous tutorial, so within the scene currently is an Audi R8 and a camera. One of the things we need to do is be able to catch any shadow information on the ground that would be generated by lights and environment. To do this we can use a matte shadow material. In the material editor create a new VrayMtlWrapper and discard the old map. In the base material assign a matte/shadow map. You may need to show incompatible materials as this is a none Vray material and in order to get it to work correctly you need to put it inside a Vray wrapper.

Click the go to parent button and tick matte surface. This will then allow you to tick shadows and affect alpha. Then set the alpha contribution to -1.

Create a Vray plane object and assign this material to it. The plane object is an infinite surface that will need to be placed under the object you are rendering; in this case it would be under the wheels of the car to act as the ground.

Adding the lighting

The scene will be lit using the HDR image created earlier. The technique is known as image based lighting (IBL). By using a HDR image and assigning it to a light dome, it will allow for much greater realism. Create a Vray light and change the type to Dome. It doesn’t matter where this light is placed as long as it is perpendicular the ground plane.

In the options tick invisible, otherwise the HDR image will be present in the background of the render. We don’t want this because we will be using the back plate we camera matched to in part 1. Under sampling change the subdivisions to 24 to improve shadow quality. Under texture click none and choose VrayHDRI from the material/map browser. Next open the material editor and click and drag the VrayHDRI into an empty slot and choose instance.

The resolution and the adaptiveness of the texture affect the way shadow rays are generated towards bright area of the HDR image. Increasing the resolution requires more RAM and slows down the render times slightly but it will make the adaptation follow the intensity of the HDR image better. Within the majority of scenes this goes unnoticed, but it is up to you what resolution you decide. The maximum you can go to is 2048. As the HDR image used within this tutorial is above that I have used the maximum value available.

In order to be able to align the HDR image correctly we will need to see it in the viewport. Go to rendering and then environment. Still within the material editor, click and drag the VrayHDRI material to the environment map slot in the environment rollout under the background parameters. Choose instance when prompted. Next go to views and then viewport background and tick use environment background and display background. Click OK and you should now see the HDR image in the viewport background.

Go back to the material editor and bring up the HDRI image. Under mapping set it spherical and tick flip horizontally, so that it is facing the right way. Next you need to align the HDR image as best as possible in accordance with your back plate. Because the aspect ratio of the HDR image does not match the viewport aspect ratio, it will not be at the correct zoom level. You just have to use your best judgement for the rotation, whilst looking for key areas in the image to align to.

In this tutorial I made sure the reflections of the house and tree are on the correct sides. You can see the top of the house reflecting in the windscreen. If you have VrayRT it will become very useful when aligning the HDR image because you can see the reflections in the active shade window as you are adjusting the rotation.

Setting the light intensity

There are two options to adjust the intensity of the light, both produce the same result and there is no advantage of using one over the other. You can either adjust the overall multiplier within the material editor or adjust the intensity multiplier of the Vray light. For this tutorial, the default multiplier for the light is too high so I have reduced it to 1 and kept the overall multiplier of the material at 1.

A note on direct lighting

Although IBL gives a very realistic approach to real world lighting and reflection, it is not direct lighting and therefore the shadows and lighting that will be created from the dome light will be very soft. In order to generate more direct light you can use VraySun or a standard target direct light. For this particular tutorial example, the sky is very over cast and there are no strong shadows which means we can get away with no direct lighting at all. If within your scene you are going to be using a direct light for the sun, you would need to find a healthy balance between that and the HDR image because one will cancel out the other when the intensity is stronger.

Render settings

Save your render as a TIF or PNG with alpha enabled and make sure the render output matches the same aspect ratio as the back plate mentioned in part 1. Make sure any environment map is switched off, and check the background colour is black. I have used a standard set-up for the render settings, you can of course use your own.

Image sampler
Adaptive DMC

Anti-aliasing filter
Mitchel-Netravali

Adaptive DMC Sampler
Min subdivs = 1
Max Subdivs = 11
Clr thresh = 0.007

Color mapping
Type = Reinhard
Burn value = 0.5

Irradiance map
Medium preset
HSph subdivs = 50
Interp. Samples = 20
Clr thresh = 0.3
Nrm thresh = 0.1
Dist thresh = 01

Light cache
Subdivs = 1000

DMC Sampler
Adaptive amount = 0.85
Noise threshold = 0.01
Min samples = 8
Global subdivs multiplier = 1

Compositing in Adobe Photoshop

Open the back plate image that you matched the camera to and open the final render. If you rendered it as a PNG, your final render will automatically remove the alpha information. If you rendered out at TIF, you have to manually remove the alpha. You can find a simple step by step guide here. Of course if you have rendered out multiple render elements you can also follow the step by step guide in that link.

Copy the back plate and paste it into the rendered image and put it at the bottom of the layer stack. Now you can apply post processing effects such as level adjustment, brightness and contrast and colour adjustment to make the render match the photo as realistically as possible. Don’t worry if your final render is a little off from the back plate image when you render the image in Autodesk 3ds Max as it is very hard to match the colour and tone exactly. So always leave time for post processing.


Viewing all articles
Browse latest Browse all 18

Latest Images

Trending Articles





Latest Images