The next type of light we'll cover is the spot light. It represents conical spot light, such as the light coming from a flashlight.
Parameters In addition to the common parameters from Light Rectangle and Light Omni , the LightSpot plugin is affected by the following specific parameters:
coneAngle - The entire spot cone, in radians penumbraAngle - The penumbra region, in radians; positive is outside the spot cone; negative is inside dropOff - The dropOff attribute falloffType - The type of transition in the penumbra region; 0 - linear; 1 - smooth cubic barnDoor - true to produce a barn door effect. barnDoorLeft - angle between the light direction and the left barn door barnDoorRight - angle between the light direction and the right barn door barnDoorTop - angle between the light direction and the top barn door barnDoorBottom - angle between the light direction and the bottom barn door useDecayRegions - True to use decay regions. startDistance1 - Start of first decay region endDistance1 - End of first decay region startDistance2 - Start of second decay region endDistance2 - End of second decay region startDistance3 - Start of third decay region endDistance3 - End of third decay region For the full list of parameters, please refer to the LightSpot plugin description in API Reference Guides .
Example Here we'll show how to add a LightSpot to a scene.
Python <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line"># Compatibility with Python 2.7.</span><span data-v-c2b1f83f="" class="line">from __future__ import print_function</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"># The directory containing the vray shared object should be present in the PYTHONPATH environment variable.</span><span data-v-c2b1f83f="" class="line"># Try to import the vray module from VRAY_SDK/python, if it is not in PYTHONPATH</span><span data-v-c2b1f83f="" class="line">import sys, os</span><span data-v-c2b1f83f="" class="line">VRAY_SDK = os.environ.get('VRAY_SDK')</span><span data-v-c2b1f83f="" class="line">if VRAY_SDK:</span><span data-v-c2b1f83f="" class="line"> sys.path.append(os.path.join(VRAY_SDK, 'python'))</span><span data-v-c2b1f83f="" class="line">import vray</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">SCENE_PATH = os.path.join(os.environ.get('VRAY_SDK'), 'scenes')</span><span data-v-c2b1f83f="" class="line"># Change process working directory to SCENE_PATH in order to be able to load relative scene resources.</span><span data-v-c2b1f83f="" class="line">os.chdir(SCENE_PATH)</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"># The renderer is automatically closed after the `with` block.</span><span data-v-c2b1f83f="" class="line">with vray.VRayRenderer() as renderer:</span><span data-v-c2b1f83f="" class="line"> # Register a simple log callback. Always useful for debugging.</span><span data-v-c2b1f83f="" class="line"> def dumpMsg(renderer, message, level, instant):</span><span data-v-c2b1f83f="" class="line"> if level == vray.LOGLEVEL_ERROR:</span><span data-v-c2b1f83f="" class="line"> print("[ERROR]", message)</span><span data-v-c2b1f83f="" class="line"> elif level == vray.LOGLEVEL_WARNING:</span><span data-v-c2b1f83f="" class="line"> print("[Warning]", message)</span><span data-v-c2b1f83f="" class="line"> elif level == vray.LOGLEVEL_INFO:</span><span data-v-c2b1f83f="" class="line"> print("[info]", message)</span><span data-v-c2b1f83f="" class="line"> # Uncomment for testing, but you might want to ignore these in real code</span><span data-v-c2b1f83f="" class="line"> #else: print("[debug]", message)</span><span data-v-c2b1f83f="" class="line"> renderer.setOnLogMessage(dumpMsg)</span><span data-v-c2b1f83f="" class="line"> # Load scene from a file.</span><span data-v-c2b1f83f="" class="line"> renderer.load(os.path.join(SCENE_PATH, 'lighting.vrscene'))</span><span data-v-c2b1f83f="" class="line"> # Remove original light source from the scene.</span><span data-v-c2b1f83f="" class="line"> del renderer.plugins["VRayLightDomeShape1"]</span><span data-v-c2b1f83f="" class="line"> # LightSpot is a light source plugin that can be used to simulate lights created by a spotlight.</span><span data-v-c2b1f83f="" class="line"> light = renderer.classes.LightSpot()</span><span data-v-c2b1f83f="" class="line"> # Specify the light position, rotation and scale.</span><span data-v-c2b1f83f="" class="line"> light.transform = vray.Transform(</span><span data-v-c2b1f83f="" class="line"> vray.Matrix(</span><span data-v-c2b1f83f="" class="line"> vray.Vector(2.220446e-016, 5.551115e-017, 1),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(0.8358706, 0.5489266, -2.160721e-016),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(-0.5489266, 0.8358706, 7.548605e-017)),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(0, 197.3685320682933, 76.22419500664734))</span><span data-v-c2b1f83f="" class="line"> # Specify the light intensity based on the 'units' parameter.</span><span data-v-c2b1f83f="" class="line"> light.intensity = 800</span><span data-v-c2b1f83f="" class="line"> # Specify the color of the light in RGB float values and alpha(1.0f)</span><span data-v-c2b1f83f="" class="line"> light.color = vray.AColor(1, 0.85, 0.5)</span><span data-v-c2b1f83f="" class="line"> # Specify the cone angle of the spot in radians.</span><span data-v-c2b1f83f="" class="line"> light.coneAngle = 0.69</span><span data-v-c2b1f83f="" class="line"> # Specify the penumbra angle of the spot in radians. Positive is outside the spot cone, negative is inside.</span><span data-v-c2b1f83f="" class="line"> light.penumbraAngle = 0.07</span><span data-v-c2b1f83f="" class="line"> # Specify the light decay type.</span><span data-v-c2b1f83f="" class="line"> # Possible values are:</span><span data-v-c2b1f83f="" class="line"> # 0 (No Decay)</span><span data-v-c2b1f83f="" class="line"> # 1 (Linear)</span><span data-v-c2b1f83f="" class="line"> # 2 (Quadratic) - default</span><span data-v-c2b1f83f="" class="line"> # 3 (Cubic)</span><span data-v-c2b1f83f="" class="line"> light.decay = 1</span><span data-v-c2b1f83f="" class="line"> # Specify shadow offset from the surface. Helps to prevent polygonal shadow artifacts on low-poly surfaces.</span><span data-v-c2b1f83f="" class="line"> light.shadowBias = 0.02</span><span data-v-c2b1f83f="" class="line"> # Specify that the bumped normal should be used to check if the light direction is below the surface.</span><span data-v-c2b1f83f="" class="line"> light.bumped_below_surface_check = True</span><span data-v-c2b1f83f="" class="line"> # Specify a threshold for the light intensity, below which the light will</span><span data-v-c2b1f83f="" class="line"> # not be computed. This can be useful in scenes with many lights, where you</span><span data-v-c2b1f83f="" class="line"> # want to limit the effect of the lights to some distance around them.</span><span data-v-c2b1f83f="" class="line"> # Larger values cut away more from the light; lower values make the light</span><span data-v-c2b1f83f="" class="line"> # range larger. If you specify 0.0, the light will be calculated for all surfaces.</span><span data-v-c2b1f83f="" class="line"> light.cutoffThreshold = 0.005</span><span data-v-c2b1f83f="" class="line"> # Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.startSync()</span><span data-v-c2b1f83f="" class="line"> # Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.waitForRenderEnd()</span></code>
C++ <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">#define VRAY_RUNTIME_LOAD_PRIMARY</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">#include "vraysdk.hpp"</span><span data-v-c2b1f83f="" class="line">#include "vrayplugins.hpp"</span><span data-v-c2b1f83f="" class="line">#include "utils.h"</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">using namespace VRay;</span><span data-v-c2b1f83f="" class="line">using namespace VRay::Plugins;</span><span data-v-c2b1f83f="" class="line">using namespace std;</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">const char *BASE_PATH = getenv("VRAY_SDK");</span><span data-v-c2b1f83f="" class="line">string SCENE_PATH = (BASE_PATH ? string(BASE_PATH) : string(".")) + PATH_DELIMITER + "scenes";</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">int main() {</span><span data-v-c2b1f83f="" class="line"> // Change process working directory to SCENE_PATH in order to be able to load relative scene resources.</span><span data-v-c2b1f83f="" class="line"> changeCurrentDir(SCENE_PATH.c_str());</span><span data-v-c2b1f83f="" class="line"> // Load V-Ray SDK library.</span><span data-v-c2b1f83f="" class="line"> VRayInit init(NULL, true);</span><span data-v-c2b1f83f="" class="line"> // Create an instance of VRayRenderer with default options. The renderer is automatically closed at the end of the current scope.</span><span data-v-c2b1f83f="" class="line"> VRayRenderer renderer;</span><span data-v-c2b1f83f="" class="line"> // It's recommended to always have a console log</span><span data-v-c2b1f83f="" class="line"> renderer.setOnLogMessage(logMessage);</span><span data-v-c2b1f83f="" class="line"> // Load scene from a file.</span><span data-v-c2b1f83f="" class="line"> renderer.load("lighting.vrscene");</span><span data-v-c2b1f83f="" class="line"> // Remove original light source from the scene.</span><span data-v-c2b1f83f="" class="line"> renderer.deletePlugin("VRayLightDomeShape1");</span><span data-v-c2b1f83f="" class="line"> // LightSpot is a light source plugin that can be used to simulate lights created by a spotlight.</span><span data-v-c2b1f83f="" class="line"> LightSpot light = renderer.newPlugin<LightSpot>();</span><span data-v-c2b1f83f="" class="line"> // Specify the light position, rotation and scale.</span><span data-v-c2b1f83f="" class="line"> light.set_transform(Transform(</span><span data-v-c2b1f83f="" class="line"> Matrix(</span><span data-v-c2b1f83f="" class="line"> Vector(2.220446e-016, 5.551115e-017, 1.0),</span><span data-v-c2b1f83f="" class="line"> Vector(0.8358706, 0.5489266, -2.160721e-016),</span><span data-v-c2b1f83f="" class="line"> Vector(-0.5489266, 0.8358706, 7.548605e-017)),</span><span data-v-c2b1f83f="" class="line"> Vector(0.0, 197.3685320682933, 76.22419500664734)));</span><span data-v-c2b1f83f="" class="line"> // Specify the light intensity based on the 'units' parameter.</span><span data-v-c2b1f83f="" class="line"> light.set_intensity(800);</span><span data-v-c2b1f83f="" class="line"> // Specify the color of the light in RGB float values and alpha(1.0f)</span><span data-v-c2b1f83f="" class="line"> light.set_color(AColor(1, 0.85, 0.5));</span><span data-v-c2b1f83f="" class="line"> // Specify the cone angle of the spot in radians.</span><span data-v-c2b1f83f="" class="line"> light.set_coneAngle(0.69f);</span><span data-v-c2b1f83f="" class="line"> // Specify the penumbra angle of the spot in radians. Positive is outside the spot cone, negative is inside.</span><span data-v-c2b1f83f="" class="line"> light.set_penumbraAngle(0.07f);</span><span data-v-c2b1f83f="" class="line"> // Specify the light decay type. Possible values are:</span><span data-v-c2b1f83f="" class="line"> // 0 (No Decay)</span><span data-v-c2b1f83f="" class="line"> // 1 (Linear)</span><span data-v-c2b1f83f="" class="line"> // 2 (Quadratic) - default</span><span data-v-c2b1f83f="" class="line"> // 3 (Cubic)</span><span data-v-c2b1f83f="" class="line"> light.set_decay(1);</span><span data-v-c2b1f83f="" class="line"> // Specify shadow offset from the surface. Helps to prevent polygonal shadow artifacts on low-poly surfaces.</span><span data-v-c2b1f83f="" class="line"> light.set_shadowBias(0.02f);</span><span data-v-c2b1f83f="" class="line"> // Specify that the bumped normal should be used to check if the light direction is below the surface.</span><span data-v-c2b1f83f="" class="line"> light.set_bumped_below_surface_check(true);</span><span data-v-c2b1f83f="" class="line"> // Specify a threshold for the light intensity, below which the light will</span><span data-v-c2b1f83f="" class="line"> // not be computed. This can be useful in scenes with many lights, where you</span><span data-v-c2b1f83f="" class="line"> // want to limit the effect of the lights to some distance around them.</span><span data-v-c2b1f83f="" class="line"> // Larger values cut away more from the light; lower values make the light</span><span data-v-c2b1f83f="" class="line"> // range larger. If you specify 0.0, the light will be calculated for all surfaces.</span><span data-v-c2b1f83f="" class="line"> light.set_cutoffThreshold(0.005f);</span><span data-v-c2b1f83f="" class="line"> // Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.startSync();</span><span data-v-c2b1f83f="" class="line"> // Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.waitForRenderEnd();</span><span data-v-c2b1f83f="" class="line"> return 0;</span><span data-v-c2b1f83f="" class="line">}</span></code>
C#.NET <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">using System;</span><span data-v-c2b1f83f="" class="line">using System.IO;</span><span data-v-c2b1f83f="" class="line">using VRay;</span><span data-v-c2b1f83f="" class="line">using VRay.Plugins;</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">namespace _10_spot</span><span data-v-c2b1f83f="" class="line">{</span><span data-v-c2b1f83f="" class="line"> class Program</span><span data-v-c2b1f83f="" class="line"> {</span><span data-v-c2b1f83f="" class="line"> static void Main(string[] args)</span><span data-v-c2b1f83f="" class="line"> {</span><span data-v-c2b1f83f="" class="line"> string SCENE_PATH = Path.Combine(Environment.GetEnvironmentVariable("VRAY_SDK"), "scenes");</span><span data-v-c2b1f83f="" class="line"> // Change process working directory to SCENE_PATH in order to be able to load relative scene resources.</span><span data-v-c2b1f83f="" class="line"> Directory.SetCurrentDirectory(SCENE_PATH);</span><span data-v-c2b1f83f="" class="line"> // Create an instance of VRayRenderer with default options. The renderer is automatically closed after the `using` block.</span><span data-v-c2b1f83f="" class="line"> using (VRayRenderer renderer = new VRayRenderer())</span><span data-v-c2b1f83f="" class="line"> {</span><span data-v-c2b1f83f="" class="line"> // Add a listener for any type of log message.</span><span data-v-c2b1f83f="" class="line"> renderer.LogMessage += new EventHandler<MessageEventArgs>((source, e) =></span><span data-v-c2b1f83f="" class="line"> {</span><span data-v-c2b1f83f="" class="line"> // You can remove the if for testing, but you might want to ignore Debug in real code</span><span data-v-c2b1f83f="" class="line"> if (e.LogLevel != LogLevelType.Debug)</span><span data-v-c2b1f83f="" class="line"> {</span><span data-v-c2b1f83f="" class="line"> Console.WriteLine(String.Format("[{0}] {1}", e.LogLevel.ToString(), e.Message));</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line"> });</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line"> // Load scene from a file.</span><span data-v-c2b1f83f="" class="line"> renderer.Load("lighting.vrscene");</span><span data-v-c2b1f83f="" class="line"> // Remove original light source from the scene.</span><span data-v-c2b1f83f="" class="line"> renderer.DeletePlugin("VRayLightDomeShape1");</span><span data-v-c2b1f83f="" class="line"> // LightSpot is a light source plugin that can be used to simulate lights created by a spotlight.</span><span data-v-c2b1f83f="" class="line"> LightSpot light = renderer.NewPlugin<LightSpot>();</span><span data-v-c2b1f83f="" class="line"> // Specify the light position, rotation and scale.</span><span data-v-c2b1f83f="" class="line"> light.Transform = new Transform(</span><span data-v-c2b1f83f="" class="line"> new Matrix(</span><span data-v-c2b1f83f="" class="line"> new Vector(2.220446e-016, 5.551115e-017, 1),</span><span data-v-c2b1f83f="" class="line"> new Vector(0.8358706, 0.5489266, -2.160721e-016),</span><span data-v-c2b1f83f="" class="line"> new Vector(-0.5489266, 0.8358706, 7.548605e-017)),</span><span data-v-c2b1f83f="" class="line"> new Vector(0, 197.3685320682933, 76.22419500664734));</span><span data-v-c2b1f83f="" class="line"> // Specify the light intensity based on the 'units' parameter.</span><span data-v-c2b1f83f="" class="line"> light.Intensity = 800;</span><span data-v-c2b1f83f="" class="line"> // Specify the color of the light in RGB float values and alpha = 1.</span><span data-v-c2b1f83f="" class="line"> light.Color = new AColor(1, 0.85, 0.5);</span><span data-v-c2b1f83f="" class="line"> // Specify the cone angle of the spot in radians.</span><span data-v-c2b1f83f="" class="line"> light.ConeAngle = 0.69F;</span><span data-v-c2b1f83f="" class="line"> // Specify the penumbra angle of the spot in radians. Positive is outside the spot cone, negative is inside.</span><span data-v-c2b1f83f="" class="line"> light.PenumbraAngle = 0.07F;</span><span data-v-c2b1f83f="" class="line"> // Specify the light decay type. Possible values are:</span><span data-v-c2b1f83f="" class="line"> // 0 (No Decay)</span><span data-v-c2b1f83f="" class="line"> // 1 (Linear)</span><span data-v-c2b1f83f="" class="line"> // 2 (Quadratic) - default</span><span data-v-c2b1f83f="" class="line"> // 3 (Cubic)</span><span data-v-c2b1f83f="" class="line"> light.Decay = 1;</span><span data-v-c2b1f83f="" class="line"> // Specify shadow offset from the surface. Helps to prevent polygonal shadow artifacts on low-poly surfaces.</span><span data-v-c2b1f83f="" class="line"> light.ShadowBias = 0.02F;</span><span data-v-c2b1f83f="" class="line"> // Specify that the bumped normal should be used to check if the light direction is below the surface.</span><span data-v-c2b1f83f="" class="line"> light.BumpedBelowSurfaceCheck = true;</span><span data-v-c2b1f83f="" class="line"> // Specify the number of parameter samples for motion blur.</span><span data-v-c2b1f83f="" class="line"> light.Nsamples = 1;</span><span data-v-c2b1f83f="" class="line"> // Specify a threshold for the light intensity, below which the light will</span><span data-v-c2b1f83f="" class="line"> // not be computed. This can be useful in scenes with many lights, where you</span><span data-v-c2b1f83f="" class="line"> // want to limit the effect of the lights to some distance around them.</span><span data-v-c2b1f83f="" class="line"> // Larger values cut away more from the light; lower values make the light</span><span data-v-c2b1f83f="" class="line"> // range larger. If you specify 0.0, the light will be calculated for all surfaces.</span><span data-v-c2b1f83f="" class="line"> light.CutoffThreshold = 0.005F;</span><span data-v-c2b1f83f="" class="line"> // Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.StartSync();</span><span data-v-c2b1f83f="" class="line"> // Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.WaitForRenderEnd();</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line"> }</span><span data-v-c2b1f83f="" class="line">}</span></code>
Node.js <code data-v-c2b1f83f=""><span data-v-c2b1f83f="" class="line">var path = require('path');</span><span data-v-c2b1f83f="" class="line">var vray = require(path.join(process.env.VRAY_SDK, 'node', 'vray'));</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">var SCENE_PATH = path.join(process.env.VRAY_SDK, 'scenes');</span><span data-v-c2b1f83f="" class="line">// Change process working directory to SCENE_PATH in order to be able to load relative scene resources.</span><span data-v-c2b1f83f="" class="line">process.chdir(SCENE_PATH);</span><span data-v-c2b1f83f="" class="line"></span><span data-v-c2b1f83f="" class="line">// Create an instance of VRayRenderer with default options.</span><span data-v-c2b1f83f="" class="line">var renderer = vray.VRayRenderer();</span><span data-v-c2b1f83f="" class="line">// It's recommended to always have a console log callback</span><span data-v-c2b1f83f="" class="line">renderer.on("logMessage", function(message, level, instant) {</span><span data-v-c2b1f83f="" class="line"> if (level == vray.LOGLEVEL_ERROR)</span><span data-v-c2b1f83f="" class="line"> console.log("[ERROR] ", message);</span><span data-v-c2b1f83f="" class="line"> else if (level == vray.LOGLEVEL_WARNING)</span><span data-v-c2b1f83f="" class="line"> console.log("[Warning] ", message);</span><span data-v-c2b1f83f="" class="line"> else if (level == vray.LOGLEVEL_INFO)</span><span data-v-c2b1f83f="" class="line"> console.log("[info] ", message);</span><span data-v-c2b1f83f="" class="line"> // Uncomment for testing, but you might want to ignore these in real code</span><span data-v-c2b1f83f="" class="line"> //else console.log("[debug] ", message);</span><span data-v-c2b1f83f="" class="line">});</span><span data-v-c2b1f83f="" class="line">// Load scene from a file asynchronously.</span><span data-v-c2b1f83f="" class="line">renderer.load("lighting.vrscene", function(err) {</span><span data-v-c2b1f83f="" class="line"> if (err) throw err;</span><span data-v-c2b1f83f="" class="line"> // Remove original light source from the scene.</span><span data-v-c2b1f83f="" class="line"> delete renderer.plugins["VRayLightDomeShape1"];</span><span data-v-c2b1f83f="" class="line"> // LightSpot is a light source plugin that can be used to simulate lights created by a spotlight.</span><span data-v-c2b1f83f="" class="line"> var light = renderer.classes.LightSpot();</span><span data-v-c2b1f83f="" class="line"> // Specify the light position, rotation and scale.</span><span data-v-c2b1f83f="" class="line"> light.transform = vray.Transform(</span><span data-v-c2b1f83f="" class="line"> vray.Matrix(</span><span data-v-c2b1f83f="" class="line"> vray.Vector(2.220446e-016, 5.551115e-017, 1),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(0.8358706, 0.5489266, -2.160721e-016),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(-0.5489266, 0.8358706, 7.548605e-017)),</span><span data-v-c2b1f83f="" class="line"> vray.Vector(0, 197.3685320682933, 76.22419500664734));</span><span data-v-c2b1f83f="" class="line"> // Specify the light intensity based on the 'units' parameter.</span><span data-v-c2b1f83f="" class="line"> light.intensity = 800;</span><span data-v-c2b1f83f="" class="line"> // Specify the color of the light in RGB float values and alpha(1.0f)</span><span data-v-c2b1f83f="" class="line"> light.color = vray.AColor(1, 0.85, 0.5);</span><span data-v-c2b1f83f="" class="line"> // Specify the cone angle of the spot in radians.</span><span data-v-c2b1f83f="" class="line"> light.coneAngle = 0.69;</span><span data-v-c2b1f83f="" class="line"> // Specify the penumbra angle of the spot in radians. Positive is outside the spot cone, negative is inside.</span><span data-v-c2b1f83f="" class="line"> light.penumbraAngle = 0.07;</span><span data-v-c2b1f83f="" class="line"> // Specify the light decay type. Possible values are:</span><span data-v-c2b1f83f="" class="line"> // 0 (No Decay)</span><span data-v-c2b1f83f="" class="line"> // 1 (Linear)</span><span data-v-c2b1f83f="" class="line"> // 2 (Quadratic) - default</span><span data-v-c2b1f83f="" class="line"> // 3 (Cubic)</span><span data-v-c2b1f83f="" class="line"> light.decay = 1;</span><span data-v-c2b1f83f="" class="line"> // Specify shadow offset from the surface. Helps to prevent polygonal shadow artifacts on low-poly surfaces.</span><span data-v-c2b1f83f="" class="line"> light.shadowBias = 0.02;</span><span data-v-c2b1f83f="" class="line"> // Specify that the bumped normal should be used to check if the light direction is below the surface.</span><span data-v-c2b1f83f="" class="line"> light.bumped_below_surface_check = true;</span><span data-v-c2b1f83f="" class="line"> // Specify a threshold for the light intensity, below which the light will</span><span data-v-c2b1f83f="" class="line"> // not be computed. This can be useful in scenes with many lights, where you</span><span data-v-c2b1f83f="" class="line"> // want to limit the effect of the lights to some distance around them.</span><span data-v-c2b1f83f="" class="line"> // Larger values cut away more from the light; lower values make the light</span><span data-v-c2b1f83f="" class="line"> // range larger. If you specify 0.0, the light will be calculated for all surfaces.</span><span data-v-c2b1f83f="" class="line"> light.cutoffThreshold = 0.005;</span><span data-v-c2b1f83f="" class="line"> // Start rendering.</span><span data-v-c2b1f83f="" class="line"> renderer.start(function(err) {</span><span data-v-c2b1f83f="" class="line"> if (err) throw err;</span><span data-v-c2b1f83f="" class="line"> // Wait for rendering to end.</span><span data-v-c2b1f83f="" class="line"> renderer.waitForRenderEnd(function() {</span><span data-v-c2b1f83f="" class="line"> renderer.close();</span><span data-v-c2b1f83f="" class="line"> });</span><span data-v-c2b1f83f="" class="line"> });</span><span data-v-c2b1f83f="" class="line">});</span></code>
Result The scene used for this render is called "Lighting_Spot.vrscene" and can be found in the scene bundle (comments on the different parameters available inside).