This page provides a tutorial on V-Ray Spherical Harmonics settings for lighting.
In this tutorial we will show how to use the V-Ray Spherical Harmonics tools for lighting a simple scene.
The first part of this tutorial is related to baking the SH in files, while the second part is dedicated to the interpretation of these files by Spherical Harmonics GI engine.
Maya starting scene can be found here. Required version Maya 2009 or higher.
1. Set V-Ray as the current rendering engine.
2. Model the scene paying additional attention to the fine and uniform subdivision of the geometry.
3. Assign materials.
4. In Render Settings, in Render Settings | V-Ray Common tab tab go to the Baking Engine Settings rollout and set the Baking engine to Spherical harmonics. This will enable Spherical harmonics options button.
5. Click the Spherical harmonics options button to call Spherical Harmonics Baking Engine options window.
Next, you will set several options.
- Fill in File name or click on Browse button to select location for the output file. (If File name field is empty, default path will be used.)
- Set Format to *.vrsh. (*.xml file format is designed to be parsed by foreign applications.)
- Set Mode to Interreflection (all). (You could set also Occlusion (all), but Occlusion (selected object)and Interreflection (selected object) cannot be rendered by V-Ray. These modes are designed for foreign applications.)
- Set Distribute to per Normal. (If we choose per Vertex the baking engine will calculate only one SH per vertex and this will smooth our sharp edges. per Normal is the predominant setting in the majority of situations.)
- Set Ray bias to 0.0001.
- Set Bands to 7.
- Set Subdivs to 70.
- Set Bounces to 2.
- Enable Use hit recording.
- Render the scene and wait until SH are calculated.
- In Render Settings, in VRay Common tab go to Image File Output and set Baking engine to None.
- In Render Settings, in Indirect Illumination tab check On option, set Primary bounces Engine to Spherical Harmonics and Secondary bounces Engine to None. Spherical Harmonics GI rollout will appear.
- Set parameters in Spherical Harmonics GI rollout:
- In Basic parameters select the *.vrsh file in File name field. Precalc light per frame parameter has meaning only when rendering animation with changing lighting, so it's value doesn't matter for this tutorial.
- In Sample environment check On option and set Subdivs to 8. We'll use just a few samples to sample the environment, because in this example we'll use plain white color for environment. In scenes with complex environment textures we should use far more samples to approximate the lighting.
- In VRay tab, in Environment rollout turn on Override Environment and put white color in Background texture.
- Turn off Apply filtering for now.
- Now turn off Sample environment and add a Maya Directional Light to the scene.
- Render some images with different light positions. The color bleeding and the shadows are computed from the precomputed spherical harmonics without additional calculations.
You may notice ringing artifacts in object shadows in the images above. To soften them turn on the Apply filtering option and play with the Filter Strength parameter to balance between ringing and blurring.
11. Combine environment lighting with directional lights and experiment!
- Keep in mind that SH are interpolated over polygons, so closely placed surfaces, where some vertices of a polygon are well lit and others aren't, could cause artifacts.