Skip to content

Latest commit

 

History

History
39 lines (23 loc) · 1.79 KB

setConstant.markdown

File metadata and controls

39 lines (23 loc) · 1.79 KB

shader.setConstant()

 
Type function
Library shader.*
See also setAlpha(), setIntensity(), setZValue(), setLinear(), setQuadratic()
Visual Guide Visual Guide

Overview

Used to set the constant value for light attenuation in the Dynamic Shader's 1 Point Light setting. The light attenuation table consists of three values {constant, linear, quadratic} The ratio of the 3 values modifies the behavior of light in the Dynamic Shader's 1 Point Light.

Not used with directional light

Syntax

shader.setConstant( number )

number is a value between 0 and 1

Examples

local shader = require 'plugin.dynamic-shader'

shader.setConstant( 0.5 ) -- sets the "constant" value for light attenuation in the Dynamic Shader's 1 Point Light setting

local lightTable = shader.getLightTable() -- get the current Dynamic Shader values

print(lightTable.constant)
-- OUTPUT: 0.5