V-Ray Wrapper Material


The VRay Wrapper can be used to specify additional surface properties per material. In this tutorial we are going to use it to cast shadows in a transparent plane.  This option is very useful in combination with SketchUp photomatch to combine a 2D image with a 3D model.

Scene courtesy of Omar Estévez C

The scene for this rendering can be found here.

Part I: Photo Match


We are not going to covering the photo match process, but it is important to mention the steps.

Step 1. We are going to import an image file as “use as new matches photo”.

Step 2. Once the image is placed, we are going to move the grid axis to align the working area with the photo.

Step 3. You can now start the modeling process.

Note: You can make the model first and then use the photo match, to locate the model in the correct position base on the image.

The first image show the photo match axis. The second image show the model. The photo match is not 100% matching the image, we tweak the photo match to fit the perspective that we wanted.

Step 4. V-Ray doesn't support the 2D camera of the Photo match. However, you can do a couple thing to get the correct camera.


Method 1 (this method will slightly change your camera)

1.1. You can move slightly the camera to get out of the 2D photo match camera.

1.2. Go to the Windows menu and select “Scene”. This will open the scene windows. Add a scene tab.

 

Method 2 (this is the one that we use here)

2.1. Go to the Windows menu and open the Ruby console windows.

2.2. Type “Sketchup.send_action 10624” without quotes. This will show you the camera parameters. Notice that the camera is set as 2D. We need to change that to 3D.

2.3. Click on the 2D-3D button to disable the 2D camera. This will give you the same camera as the photo match.

2.4. Close the window by clicking on the X.

2.5. Go to the Windows menu and select “Scene”. This will open the scene windows. Add a scene tab.

Rendering takes more time now as V-Ray needs to calculate a more precise Antialiasing solution.

Part II: Flat Image on the Background


In order to be able to see the image on the render, we have to place it as our background. Until this build, we were not able to use flat images in the Environment. We add a new feature called “screen” environment mode, to be able to achieve this effect. How does it work?

Step 1. Go to the environment rollout and click on the “M” near Reflection/refraction (background).

Step 2. Select “TexBitmap” as our mapping type.

Step 3. select the same image that you use for the photo match.

Step 4. Under the UVW type, selec “UVWGenEnvironment”

Step 5. Select “screen” as your mapping type and click OK- this is the option that allows you tochange the multiplier of the background to 10 to correct the exposure of the image.

Part III: Image Placement


Our image will be visible in the render, but it will be stretched through the image output size. We need the same aspect ratio of the image. It is a good time to use RT to adjust the “placement” of the image in the background.

Step 1. Start RT. Notice that the image is stretched.

Step 2. Click on the “M” near the Reflection/refraction (background) to called the texture editor.

Step 3. I the texture editor change the “Placement Type” to “Place”. This will allows you to change the position of the image in the background.

Step 4. Change the width to 0.905, then click OK. This will reduce the size of the image. This operation is manual.

You have to use trial and error, that is why RT is very useful for this.

Notice in the image how the Sketchup viewport and the RT match.

Part IV: Wrapper Geometry


In order to use the wrapper material, we need some geometries in which we are going to cast shadows. In this scene I would like to get some GI and shadows on the background building and on the floor. The idea is to use the same floor of the image. So, we need to create two geometries where we’re going to apply the wrapper material. The floor will be a flat plane. In the wall I want to get some Ambient occlusion in the facade, so we are going to add a simple detail.

This is the image with the geometries for the wrapper material. Notis all the shadows and ambient occlusion that those geometries are getting and generating. That is the reason we add the small detail in the geometry in the facade.

Part V: Wrapper Material


Once we have the geometries, we are going to create and apply the wrapper material to them.

Step 1. Open the material editor by clicking the first icon on the V-Ray toolbar.

Step 2. Right click on the “Scene Materials”, then select “Create Material”, then “Wrapper Material”

Step 3. Double click on the new material and rename as “Wrapper Mat”.

Step 4. We need a base material for the wrapper material. Select the “Color_001” for this tutorial. The base material should depend of the image area in which we want to cast shadow. If the area on the image has a reflection, we could use a material with a reflection layer, to be able to cast reflections on the wrapper material. In this case the floor and the building do not have reflection properties, so we are going to use a material with just diffuse layer.

Step 5. Enable the “Matte” option - this will produce the transparency effect on the material, to be able to see the background.

Step 6. Enable the “Shadow” option - this will allows you to cast shadows in the transparent geometry.

Step 7. Enable the “Affect Alpha” option  - this option will affect the alpha contribution of the matte geometries. So you will see the effect in the alpha channel.

Step 8. Change the “Alpha contribution” to -1.0 - This will allows you to see the alpha of the shadow and not the alpha of the matte geometries.

Step 9. Change the “Matte for secondary rays” option to “All secondary rays” - this will allows you to get the reflection of the environment in the reflective object,  instead of the reflection of matte geometries.

Step 10. Select the matter geometries and apply the new wrapper material to them.

Tips: It is very important that the normals of the geometries that have the wrapper material are pointing up. The front face of the material should be facing up.

Dome light environment is not compatible with the wrapper material. The dome light have to be invisible and the same image of the dome light should be place in the Environment Reflection/refraction (background) option.

Part VI: Rendering the Image


Notice how we get shadows on the floor and facade of the images. Wrapper material it is a very powerful tool for compositing process.

This is the V-Ray for SketchUp Raw render. Notice that we are able to render shadows on transparent geometries. Also we are able to render a flat background directly in the V-Ray frame buffer using the new screen environment mode.

Final image.  Simple color and distortion correction in Photoshop.

The final scene for this rendering can be found here.