VRayLensEffects Render

This tutorial shows you how to setup the V-Ray Lens Effects plugin. The effect appears in areas that are extremely bright which can sometimes lead to harsh black edges caused by over exposed pixels. The change from one extremely bright pixel to a dull pixel is what makes this anomaly happen. In real life this is noticeable when taking a digital photograph of something that is extremely bright such as the sun. However the resulting photograph will have bloom type effects that show some colour bleeding. The V-Ray Lens Effects replicates this by adding an additional element to the render. The bloom and glare effects develop from a source image which is generated by the plugin after the render is complete.


If you would like access to the scene files used in this tutorial please click here to download.

In the environment and effects rollout under the effects tab, add the V-Ray Lens Effects option. Under the parameters turn on both bloom and glare options. This effect is applied after rendering making it easy to adjust the settings to get the desired result without having to re-render the scene each time it is updated.

Access the V-Ray Lens Effects via the environment and effects rollout

VRayLensEffects Fig01

The bloom effect adds a blurred halo and is controlled via three parameters; size, weight and shape. You can also turn on fill edges so that the bloom effect continues outside of the rendered image to avoid any darkened edges or a sudden cut off.

The glare effect can be adjusted by the weight and size parameters. If using a VRayPhysicalCamera you can choose to take the settings from that or add your own settings by choosing from camera parameters in the dropdown list. The final option is to use an image using the Filter Generator tool or your own custom image.

Turn on both the bloom and glare effects before rendering so that V-Ray knows to activate the plugin. If you choose to turn on the effects after the initial render is complete V-Ray will re-render the scene.

You can control where the bloom and glare effects appear on the rendered image. Every pixel has a colour float value. The brighter the pixel, the higher the value. By setting the mask intensity to a specific value, everything below will be ignored by the lens effect as it creates an alpha mask. Both effects also have material or object ID options which you can use to make the effect only appear on these ID’s. This is useful when increasing the mask intensity in order to generate a finer mask, causing the unclamped colours to have white or black halos surrounding the pixels.

To get the colour float value of a particular pixel, you first must render a draft version or a cropped section to save some rendering time. Make sure the V-Ray Frame Buffer is enabled and render using the 3ds Max standard button in the render setup.

Once the render is complete, choose LensEffectsSource element from the dropdown list in the V-Ray Frame Buffer. This is an unclamped element which is not affected by the colour mapping options from the V-Ray render settings. Right click on a pixel where you want the effects to appear and note down the first value in the colour (float pixel information).

Choose a float colour value from the unclamped LensEffectsSource element

VRayLensEffects Fig02

Enter the mask intensity for both bloom and glare effects and setup your final production render settings. Now render the image by clicking the 3ds Max render button. Whilst V-Ray is rendering the final image you can check your mask is correct by selecting it from the drop down list in the top left corner of the V-Ray Frame Buffer.

Use intensity masking to control where the effects appear

VRayLensEffects Fig03

Use the update effect button each time you adjust a parameter to view the results. Once you are happy with the results you can save out the final render through the V-Ray Frame Buffer.

Create your own glare filter using the Filter Generator

VRayLensEffects Fig04

Adjust each component layer of the filter via the 4 tabs at the top. See the results of the composited filter in the lower panel. The Filter Generator can be found in tools within the Chaos Group/ V-Ray Advanced start menu folder.

Export the filter as a HDRI

VRayLensEffects Fig05

When you have finished creating your filter you can export it is a HDRI. This allows for maximum dynamic range for luminosity.

Add dust and dirt to the glare filter

VRayLensEffects Fig06

You can also add dirt and dust that would typically appear on a lens by using an obstacle mask which will change the appearance of the glare.

Watch the video tutorial