V-Ray Render Elements - Rendering and Compositing in Photoshop


Final Composition

Rendering out into elements is a fantastic way of having more control over your images and animations in post production. There are however few tutorials that show how to do this from start to finish in an efficient way. This tutorial will guide you through the entire process from start to finish of rendering a scene into various passes, and how to composite it back together in Photoshop. This can also be applied to After Effects or any other compositing program if you are creating an animation.

In this tutorial we will:

Set up the scene in 3ds Max to render out various elements.
Composite them back together using photoshop.
Add specular bloom to bright areas to enhance realism.

V-Ray is a full HDRI renderer - producing full high dynamic range images. This is great for post production as it allows you to change the image exposure without losing any quality. In order to take advantage of this we need to set up V-Ray to save 32-Bit OpenEXR Files.



So what's OpenEXR and HDRI?

Both OpenEXR and HDRI images are high dynamic range files - capable of holding much more colour information than a monitor can display. A normal 8-bit per channel jpeg or tiff contains a total of 16.7 million colours (256*256*256). A high dynamic range file is capable of holding 32-bits per channel, allowing it to contain a total of 4722366482869645213696 different colours! An OpenEXR file is practically the same as an HDRI file, but it can contain many layers and compression methods. It was developed by ILM for use in-house for their renders, and has been made freely available to all 3D users.

So why is this useful?

The amount of colour information stored in a full 32-bit floating point file allows you an incredible amount of control in post production. For example, below is a render of a sphere with a vray light material applied with an intensity of 100. To the left is a normal 8-bit per channel bitmap, to the right is a 32-bit per channel float. Notice as I reduce the exposure what happens. On the normal image the sphere simply becomes darker. However on the right the extra light information in the exr file is telling photoshop that the light is still very bright - and it was actually a red light but was so bright it appeared white! The normal 8-bit per channel image has lost a large amount of colour information when it was saved, however the high dynamic range image has retained all the information.

Exposure Example

Hopefully this example has shown you why rendering in hdr is so powerful. HDR Files retain a massive amount of colour information - including totally burnt out areas that appear white. The only slight issue with rendering to hdri is the jagged edges produced due to the massive contrast in colour levels. The workaround to this is to add specular bloom which we will be doing later.

Setting up the Scene

Firstly, we need to set up 3ds Max. If you do not have a scene to work on, please download this 3ds Max file. (Made in 3ds Max 2009 and V-ray 1.5 SP2)

With V-Ray it's possible to save all render elements into a single OpenEXR File, allowing you to open one file in photoshop with all the render elements as a separate layer.


Turn on V-Ray Frame Buffer and tick "Render to V-Ray RAW Image File". Click Browse and choose a location to save the image. Once you have chosen a save location change the file extension from .vrimg to .exr and press save.


Next its time to set up all the render element passes:


Go to the Render Elements tab and enable "Elements Active". Click "Add" and select these elements:

VRay_Reflection
VRay_GlobalIllumination
VRay_Lighting
VRay_Specular

If you need an alpha channel add "VRay_Alpha". At the moment these are the only elements required. If you are rendering out an animation you may want to enable the Velocity pass as well. A tutorial for this will be coming soon.

PLEASE NOTE - IF THE VRAY FRAME BUFFER IS ENABLED, ELEMENTS WILL APPEAR UNTICKED AND TURNED OFF.
THIS IS NORMAL AND WILL RENDER FINE.


Finally, once everything is ready press render.


Compositing the Elements in Photoshop

Open up the rendered OpenEXR file in Photoshop. If you do not have the file but would like to learn how to composite the passes please download this file.

If you can only see one layer in Photoshop called RGBA it's because you need a plugin called ProEXR to read the rest of the layers. There is a free 15 day trial for this plugin if you would like to use it which can be found here. Adobe Photoshop can read exr files but in a very limited way, which is why this plugin is required.

An alternative to using this plugin is to render out each frame into a seperate exr file. Simply turn off the V-Ray frame buffer, enable all the render elements and choose a save location.


Once the plugin is loaded correctly you should be able to see all these passes. The top layer "RGBA" is a pre-calculated composite of all the elements. It isn't needed so you can hide it from view by pressing the eye to the left of it. The Specular layer is actually not needed in this example scene so can be safely deleted. I added it to show you that it is an important element if you have any specular reflections in your scene.


We are going to composite all the layers together by changing the blending mode. At the moment they are all on "normal".

As you can see some of the blending modes are greyed out. This is because the image is a full 32-bit per channel file. If for any reason you want to use a greyed out blending mode you will have to change the file to either 8 or 16-bit perchannel. This can be done by pressing Image>Mode>X_Bits Per Channel.

We want to add all of the elements together, so change all of the layers to "Linear Dodge (Add)". It doesn't matter what order your layers are in as they are all being added to each other.

Your image should now look like the reference RGBA layer - unhide it to check.

Simple huh!



Adding Specular Bloom

Specular bloom really helps make an image go from being good to great. It's also a really handy way of getting rid of aliased (jagged) edges around very bright lights/reflections.

Jagged edges are a problem with all HDRI renderers and not just a problem with V-Ray. Very bright areas can be much more intense than other areas in the scene, and for this reason even on very high quality render settings jagged edges can occur.

There are two solutions to this problem:

1. Make V-Ray work as a normal 8-bit per channel renderer by clamping the output values. Under "Color Mapping" tick "Clamp Output" and "Sub-Pixel Mapping".

2. Add specular bloom to the very bright areas in order to blur the jagged edges into the rest of the scene. This is the preferred method as it allows you to have full 32-bit HDRI images and it also acts the way a normal camera would in real life.


In Photoshop duplicate the "VRay_Reflections" layer and hide all layers except the newly duplicated one.

Adjust the Gamma by pressing Image>Adjustments>Exposure and use the Settings in the Image.

Change the opacity of the Layer to around 3%. This value is very low as the whites are so bright due to the HDRI file.

Unhide all the layers and then add a blur to the gamma adjusted reflection Layer by going to Filter>Blur>Gaussian Blur.

Adjust the blur amount to around 7 pixels.


Sometimes this may not produce the desired results for bloom due to the diverse amount of brightness contained in an hdr file (some whites will bloom massively compared to others). This is entirely accurate and the way a real life camera would behave, but this sometimes may not work for your particular scene. To overcome this you can convert the duplicated layer to 8-bit and then apply the bloom by adjusting the brightness/contrast values. The best way to do this would be to copy the layer into a new image in photoshop, convert it to 8-bpc, adjust the brightness/contrast, and then drag the image back into the main composition changing the blending mode to dodge (add) and adding a blur.

Hopefully you have managed to follow all the steps and create a composited image.


So why did we just do that?

Rendering out into different elements, especially hdr elements, allows us an incredible amount of post production control.

For example - say we want to change the amount of reflection after the image has rendered. Go to Image>Adjustments>Levels and change the amount of reflection using the levels tool. This is a very simple example of how powerful render passes can be.



Thank you for reading this, and I hope you will find it useful. Tim.

Comments - please feel free to leave a comment :-)
Bernard says:
11th November, 2009 at 5:43pm
Man you saved my ass ;)
Rodrigo says:
11th November, 2009 at 5:44pm
Hey man nice tutorial. Thanks.
tchelo says:
11th November, 2009 at 5:44pm
Tks, Tim! This is great stuff. Will be visiting it here very often to learn some more.
Rich says:
11th November, 2009 at 5:45pm
Setting this up now. but i've noticed when changing the file extention from the default vray to the Exr that there are no setup options to change bitrate/compression etc. Is the possible?

cheers
Tim - timsportfolio.co.uk says:
11th November, 2009 at 6:44pm
Hi Rich, thanks for the comment. When saving to exr from vray there are no available options to choose from (perhaps this will come in later versions). All exr files are saved as 32-bit floats, even if you are using clamp output and therefore only have an 8-bit per channel image. As far as I am aware vray uses no compression when saving the exr files, but the sizes do vary because only pixel data that is generated is saved.

Hope this is of help
Tim
Anthony says:
11th November, 2009 at 5:53pm
Amazing, and yet so simple. I can't thank you enough for sharing this info with us all :)
Munnas says:
11th November, 2009 at 5:54pm
This Is Nice Tutorial Thank U
Anonymous says:
11th November, 2009 at 5:57pm
Thank you, please if you can post a more advanced tut on compositing vray elements in photoshop would be great. There's nothing around like this.
Demma says:
11th November, 2009 at 5:58pm
Very usefull, thanks!!!
moekitect says:
11th November, 2009 at 6:06pm
whew!! that was an awesome lesson you shared there for us. ...thank you very much, sir!
Anonymous says:
11th November, 2009 at 6:06pm
thnks sir...........very useful for me
Invitado says:
11th November, 2009 at 6:07pm
maybe this is a stupid question, but how do I save as an .exr file?
I'm using 3ds max 2009 but I have absolutely no idea about how to do this
Tim - timsportfolio.co.uk says:
11th November, 2009 at 6:43pm
Two ways:
1. Choose to save as .exr in 3ds max render settings under image format choice (tif/tga/jpg etc).
2. Enable Vray Frame Buffer and type in image.exr - Vray will then save as an exr file.
Have a look at 'Setting up the Scene' in this tutorial and it explains how to do this in more detail.
Anonymous says:
25th November, 2009 at 5:53pm
Thanks for the tutorial
Marty says:
8th January, 2010 at 6:12pm
You can also smooth jagged edges on over bright reflections with the Soften option in the BRDF rollout in the VRayMtl. 0.1 works well in most instances.
Tim - timsportfolio.co.uk says:
9th January, 2010 at 12:01pm
Hi Marty, thanks for the tip! I'll have to look into this :)
Tibu says:
16th February, 2010 at 7:01pm
Hi, thanks for the tutorial.
I get a message error in photoshop when i open the .exr file.
No way to open it.
I use CS3 and Vray 1.5R3 + Max9.
Any idea ?
Best.
Tibu says:
16th February, 2010 at 7:34pm
Forget about my last comment, exr seems to be a non valid format in Vray1.5R3
Olive says:
25th February, 2010 at 8:57am
Thanks for the tut, however i can't succeed in reproducing this process in another project: the composite i get from this four elements in PS is slightly different from the composite i get out directly from Vray. Can't figure out what is the cause.
Anyway that was of great help, thanks for that
leo says:
1st March, 2010 at 4:03pm
Hello, I am using Vray in Rhinoceros. The 32bit renderized file following your tutorial, only has rgb,red,green,blue channels in photoshop. I also tried opening your .exr file and it does not work. Can you help me?
Thanks for the tutorial
Very usefull
Tim - timsportfolio.co.uk says:
1st March, 2010 at 4:20pm
Hi Leo,

It's probably because you do not have ProEXR installed on your computer, however it may be because Vray is different in Rhinoceros. I've never used Rhinoceros so couldn't tell you.

Have a look at "Compositing the Elements in Photoshop" above as it shows you how to set up Vray and gives a link to ProEXR.

If it still won't work I'd set your scene to render each element out to a seperate file (turn off the Vray Frame Buffer to do this).

Hope this is of help.

Tim
timsportfolio.co.uk
adom86 says:
6th March, 2010 at 2:21pm
Hey Tim, great tutorial as I am a total beginner at compositing at the moment.

Just a few questions regarding what elements to render out. I followed your tutorial but I had output the same elements as TGA files as for some unknown reason ProEXR doesnt seem to want to work with PhotoShop 32 or 64bit CS4 version.

Anyway Its just a question to help me understand it more. I have managed to reproduce the same image as the beauty shot but I dont get how it has done it without having elements such as shadow and diffuse. I am clearly wrong in how I have been thinking but I just assumed you had to have all the elements rendered out in order to reproduce the original image.

Will this translate over to After Effects do you know as there arent many decent guides on the video side of things :)

Cheers for the help!
Tim - timsportfolio.co.uk says:
8th March, 2010 at 11:08am
Hi Adom86,

Thanks for leaving a comment. Firstly apologies for your comment appearing in the wrong order - it was a bug I wasn't aware of and it's been fixed now :)

It's odd that ProEXR isn't working for you. By default Photoshop should load the EXR file but only with the first beauty layer visible. In order to gain access to the other layers you need to drag the ProEXR plugin into the photoshop plugins folder AND remove the default EXR plugin. Perhaps this is the problem?

TGA is probably not the best format as it cannot handle full floats. Try using 48 bit png files instead. They arn't full floats but will give a huge amount of colour info compared to a normal file and should be more than sufficient.

It's a good question and I can understand why you're a little confused, and you're absolutely correct.

If the render is seperated into every single pass then yes, you do have to add a diffuse pass, lighting pass, gi pass etc.

The reason a diffuse pass is not required is because the diffuse has already been multiplied with the GI and lighting pass. If you wanted to get the GI and lighting pass with no diffuse then you would have to render a raw pass, and then multiply the diffuse with the raw - which would give you the non raw pass.

This extra complication really isn't needed because it's possible to get the raw pass if needed in post by subtracting diffuse from the normal lighting/gi pass. Shadows are a bit of an odd one. If you are rendering with Ambient Occlusion then yes, you would multiply this to your comp. The lighting layer works in a similar way to the Ambient Occlusion layer in a comp as it is multiplied with the diffuse - making the diffuse layer darker in the shadow areas.

I'd hightly recommend this tutorial as it goes through some advanced compositing using the node based compositor Fusion: http://www.thegnomonworkshop.com/store/product/431/Multi-Pass-compositing

It is possible to use After Effects to composite all elements together but it can be trickier due to its quite unique layer based approach at compositing. If you're working with floats in AE remember to go to file>project settings and change the bit depth for it to properly work.

Hope this is of help, please feel free to ask any more questions if you're stuck.

All the best.
Tim
Puneetpal Rikhi says:
16th March, 2010 at 11:14am
Thank you sir...
Bel says:
29th March, 2010 at 7:02pm
Thank you very much for this useful tutorial, but I still have a question: How do you render de shadows apart from the light
niksoftarg says:
4th April, 2010 at 10:01pm
Hi did you take a look at this? http://www.chaosgroup.com/forums/vbulletin/showthread.php?49017-32-bit-exr-s they say that the Vray Frame Buffer only saves a Half Float Exr as default not 32bit.....
Tim - timsportfolio.co.uk says:
4th April, 2010 at 10:20pm
niksoftarg - Thanks for the link!

I had absolutely no idea V-Ray defaulted to 16-bit floats by default. When I get the time I'll update this tutorial with this information. Cheers!

Bel - I'll look into rendering shadows and compositing them separately. I've messed around with it before and got some nice results but I can't remember off hand.
softy says:
2nd June, 2010 at 1:04pm
Hi first of all great Tutorial.
I tried this with Vray for Maya and it also worked, But when i import the exr File into Photoshop my layer looks washed out it dont look like the Final Render in my Maya Renderviewport.
Do you know why ??

And in Maya ther is no option to check the attribute: Render to V-Ray RAW Image File

Or can you explain a little bit how to set the Settings for the Linear Workflow, maybe this is the Problem.

thanks