It's only natural nowadays that we have started adding backplates with a background image behind the windows of our interiors. With this workflow as opposed to the old one (adding our backgrounds in post) we get the benefit of having these backgrounds reflected into our scene. This gives a more realistic feel to our shots and is definitely the right direction for improving our work.
Our current workflow, however, has its downsides.
- Rendering our background in 3D makes it virtually impossible to swap later on in 2D without messing too much with compositing and even then the results aren't as plausible.
Often times we change the background a few times during production and every time we have to re-render the image which takes up some time.
- Background images that we use often times have terrible colour clipping which we more or less can't control.
- Because of the aforementioned reasons, even simple editing of the background is a bit tricky
Our workflow has its downsides but is in the right direction. This means that it's just a bit incomplete. In other words, we can try to improve on the points mentioned above.
There are a few ways to do the trick, however, most require rendering of additional passes and somewhat complex compositing which is not ideal for our case. So let us examine a less painful way to do this.
Good compositing requires good preparation so we need to do a few things before rendering our scene:
1. REFRACTIVE OBJECTS SETUP:
We have to isolate all of the objects which will be refracting our background. As we need to include their transparency into our alpha channel we have to adjust how their refractions are seen in our render elements.
Affect all channels needs to be turned on for the refractions. Colour only or Colour + Alpha won't be enough in our case.
2. BACKPLATE SETUP:
We need to go to the Object Properties of our backplate and adjust a few things. Cast Shadows, Receive Shadows, Visible to Camera all need to be turned off.
Next step is to go into the VRay Properties and set the Alpha Contribution to -1 - this basically means that the object will cut away from the alpha channel.
3. BACKPLATE SHADER SETUP:
Here comes the interesting bit and where we need to use a bit of trickery. As reflections and refractions are tightly connected in 3ds Max and VRay we need to find a way to separate them. The VRay Properties tab offers some separation but it doesn't work for our situation. What we can do then is to setup a more complex shader for our backplate.
First, we can create our standard initial backplate material be it VRayMtl or VRayLightMtl and adjust it so we are happy with the way it looks in our reflections. We now plug this material the Reflection slot of a VRayOverrideMtl  (remember we only want our backplate to be seen in the reflections). For the all of the other slots, we need to create an additional shader which in this case is a simple VRayMlt with pure black Diffuse.
We are now ready to render out our image
4. COMPOSITING:
As mentioned, good preparation is crucial for good compositing. We can now simply open up our .exr in Fusion, put it into the FG slot of a Merge Node, choose our background and put it in the BG slot.
Voila, it works just like that. Now we have the freedom to move around our Background as much as we want, colour correct it or even swap it entirely.
CASE STUDIES
All is good in theory but let us observe how far would this workflow work and where it would break.
CASE STUDY 1.0:
Let's skip the basics and start from something a bit more complex:
- Double glazed windows
- Objects refracted behind windows glass (balcony railing)
- Semi-transparent object in front of the window glass (curtain) with VRay2SidedMtl
Resulting images - on the left we have an image with BG rendered out of Max and on the right, we have our composite:
Obviously, these two images are not exactly identical but still very close.
1. Note how much colour clipping occurs in the original image, while our composite looks much better - and we actually still have the control to minimise the defect even more!
2. The reflections in our composite are a tad too strong compared to what comes from the original render.
Let's see how we can tweak our image if the strong reflections are actually an issue:
To adjust the reflections we simply need to render out a Reflection Pass. Reflections are usually added but in our case, we need to subtract them from the image.
We can do this with a simple Boolean operation while working on the reflections only on the window glass itself (we can use our Alpha Channel as a mask and render another mask for our curtain so we can exclude it from our operation):
We can control the amount of reflection with the Blend value:
Another comparison shows that we can get very very close to the original if we want:
CASE STUDY 2.0:
We've tested a few things so far but there might be even more troublesome scenarios. Something that we often have in our scenes, for example, is a vase with flowers floating in mid air like in the example below :)
How can we achieve this amazing effect? It might look complex, but we've all seen David Blaine do levitation - so it should be a matter of simple mechanics in the end.
Seriously now, keeping in mind the exact same workflow we used for our previous case study we are almost there (mind now that we need to adjust the materials of the vase and the liquid inside).
Let's examine how our alpha channel looks after we render out our image:
If we put our background now the only issue would be that it won't be distorted when viewed through the vase. In other words, we need to fake the IOR of the glass.
We can do this using a VRayNormals Pass in combination with the Displace Node in Fusion (Tools>Warp>Displace) while masking the effect with our alpha channel + a mask for our vase:
Before and After: