setLightAttenuation: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (updated example)
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(50 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.50


|0.50|= Game version
|gr1= Lights
|arg= local |=
|eff= local |= Effects in MP
____________________________________________________________________________________________


| Sets attenuation of light. Standard method of attenuation (1 / (constant + linear*dist + quadratic*dist*dist)). ''start'' param represents distance, where the attenuation starts to take effects (dist <nowiki>=</nowiki> distance - start). |= Description
|arg= local
____________________________________________________________________________________________


| light '''setLightAttenuation''' [start, constant, linear, quadratic, hardlimitstart, hardlimitend] |= Syntax
|eff= local


|p1= light: [[Object]]  |= PARAMETER1
|descr= Sets attenuation of light. Standard method of attenuation (1 / (constant + linear*dist + quadratic*dist*dist)).
''start'' param represents distance where the attenuation starts to take effects (dist = distance - start).


|p2= [start, constant, linear, quadratic, hardlimitstart, hardlimitend]: [[Array]]  |= PARAMETER2
|s1= light [[setLightAttenuation]] [start, constant, linear, quadratic, hardlimitstart, hardlimitend]


|p3= start: [[Number]] - distance with 100% intensity, falloff starts here  |= PARAMETER3
|p1= light: [[Object]]


|p4= constant: [[Number]] - constant attenuation coef  |= PARAMETER4
|p2= start: [[Number]] - distance with 100% intensity, falloff starts here


|p5= linear: [[Number]] - linear attenuation coef |= PARAMETER5
|p3= constant: [[Number]] - constant attenuation coef


|p6= quadratic: [[Number]] - quadratic attenuation coef |= PARAMETER6
|p4= linear: [[Number]] - linear attenuation coef


|p7= hardlimitstart (Optional): [[Number]] - max distance hard limit start (start of fading of intensity to 0) in m |= PARAMETER7
|p5= quadratic: [[Number]] - quadratic attenuation coef


|p8= hardlimitend (Optional): [[Number]] - max distance hard limit end (end of fading of intensity to 0) in m |= PARAMETER8
|p6= hardlimitstart: [[Number]] - (Optional) max distance hard limit start (start of fading of intensity to 0) in m


| [[Nothing]] |= RETURNVALUE
|p7= hardlimitend: [[Number]] - (Optional) max distance hard limit end (end of fading of intensity to 0) in m


____________________________________________________________________________________________
|r1= [[Nothing]]


|x1= <sqf>myLight setLightAttenuation [2, 4, 4, 0, 9, 10];</sqf>


 
|seealso= [[setLightAmbient]] [[setLightColor]] [[lightAttachObject]] [[lightDetachObject]] [[setLightBrightness]] [[setLightIntensity]] [[setLightUseFlare]] [[setLightFlareSize]] [[setLightFlareMaxDistance]] [[setLightDayLight]]
 
|x1= <code>myLight setLightAttenuation [2,4,4,0,9,10];</code> |= Example 1
____________________________________________________________________________________________
 
 
| [[setLightAmbient]], [[setLightColor]], [[lightAttachObject]], [[lightDetachObject]], [[setLightBrightness]], [[setLightIntensity]], [[setLightUseFlare]], [[setLightFlareSize]], [[setLightFlareMaxDistance]], [[setLightDayLight]] |= See also
 
|  |= MPBEHAVIOUR
____________________________________________________________________________________________
}}
}}


<h3 style='display:none'>Notes</h3>
{{Note
<dl class='command_description'>
|user= ffur2007slx2_5
<!-- Note Section BEGIN -->
|timestamp= 20140325123100
<dd class="notedate">Posted on Mar 25, 2014 - 12:31
|text= (A3 1.14) [[setLightAttenuation]] array will present fallowing visual effects:<br>
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note">
(A3 1.14) [[setLightAttenuation]] array will present fallowing visual effects:<br>
<br>
<br>
[start(SCALAR), constant(SCALAR), linear (SCALAR), quadratic(SCALAR)]<br>
[start(SCALAR), constant(SCALAR), linear (SCALAR), quadratic(SCALAR)]<br>
<br>
<br>
'''start(SCALAR)''' – Number can be unlimited, this parameter determines the range that the light source takes effect. Terrain environmental color will be bathed by [[‎setLightAmbient]] within the range and its covered objects will reflect the color by [[‎setLightColor]].<br>
'''start(SCALAR)''' – Number can be unlimited, this parameter determines the range that the light source takes effect. Terrain environmental color will be bathed by [[setLightAmbient]] within the range and its covered objects will reflect the color by [[setLightColor]].<br>
<br>
<br>
'''constant(SCALAR)''' – Support signed number, this parameter determines the brightness proportion of the light source, higher the number is, less the brightness will be, vice versa. Any minus value passed will be treated as 0 (100% brightness). In other words, this parameter is related with [[‎‎setLightBrightness]] and [[‎setLightIntensity]].<br>
'''constant(SCALAR)''' – Support signed number, this parameter determines the brightness proportion of the light source, higher the number is, less the brightness will be, vice versa. Any minus value passed will be treated as 0 (100% brightness). In other words, this parameter is related with [[setLightBrightness]] and [[setLightIntensity]].<br>
<br>
<br>
'''linear (SCALAR)''' – Support signed number, effective range is from 0 ~ 100 (passed minus value will be treated as 0), this parameter determines the concentration of the light source, higher the number is, more will the light concentrate, vice versa. In other words, this parameter will turn the source into spotlight and sharpens its light circle border.<br>
'''linear (SCALAR)''' – Support signed number, effective range is from 0 ~ 100 (passed minus value will be treated as 0), this parameter determines the concentration of the light source, higher the number is, more will the light concentrate, vice versa. In other words, this parameter will turn the source into spotlight and sharpens its light circle border.<br>
Please pay attention to a special value: '''4.31918e-005'''<br>
Please pay attention to a special value: '''4.31918e-005'''<br>
e.g.<br>
e.g.<br>
<code>
<sqf>
_light [[setLightAttenuation]] [2,4,'''4.31918e-005''',0]; //This value will make the light source reach an ultra high effect range. <br>Any initial param set before will be discarded and overwritten.
// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten.
</code>  
_light setLightAttenuation [2, 4, 4.31918e-005, 0];
</sqf>  
<br>
<br>
'''quadratic(SCALAR)''' – Support signed number (range unlimited, passed minus number will be treated as 0), this parameter determines the range that the light source is visible and its visual presentation looks similar to linear. 0 means the maximum visible range. In further explanation, a less bright source can’t be seen out of the range on the land but still visible on the sea, and a bright enough source won’t be effected by the passed range who is still visible out of the range.<br>
'''quadratic(SCALAR)''' – Support signed number (range unlimited, passed minus number will be treated as 0), this parameter determines the range that the light source is visible and its visual presentation looks similar to linear. 0 means the maximum visible range. In further explanation, a less bright source can’t be seen out of the range on the land but still visible on the sea, and a bright enough source won’t be effected by the passed range who is still visible out of the range.<br>
Please pay attention to a special value: '''4.31918e-005'''<br>
Please pay attention to a special value: '''4.31918e-005'''<br>
e.g.<br>
e.g.<br>
<code>
<sqf>
_light [[setLightAttenuation]] [6,0,0,'''4.31918e-005''']; //This value will make the light source reach an ultra high effect range.<br> Any initial param set before will be discarded and overwritten.
// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten.
</code>
_light setLightAttenuation [6, 0, 0, 4.31918e-005];
 
</sqf>  
 
}}
<!-- Note Section END -->
</dl>
 
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 19:43, 3 September 2024

Hover & click on the images for description

Description

Description:
Sets attenuation of light. Standard method of attenuation (1 / (constant + linear*dist + quadratic*dist*dist)). start param represents distance where the attenuation starts to take effects (dist = distance - start).
Groups:
Lights

Syntax

Syntax:
light setLightAttenuation [start, constant, linear, quadratic, hardlimitstart, hardlimitend]
Parameters:
light: Object
start: Number - distance with 100% intensity, falloff starts here
constant: Number - constant attenuation coef
linear: Number - linear attenuation coef
quadratic: Number - quadratic attenuation coef
hardlimitstart: Number - (Optional) max distance hard limit start (start of fading of intensity to 0) in m
hardlimitend: Number - (Optional) max distance hard limit end (end of fading of intensity to 0) in m
Return Value:
Nothing

Examples

Example 1:
myLight setLightAttenuation [2, 4, 4, 0, 9, 10];

Additional Information

See also:
setLightAmbient setLightColor lightAttachObject lightDetachObject setLightBrightness setLightIntensity setLightUseFlare setLightFlareSize setLightFlareMaxDistance setLightDayLight

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
ffur2007slx2_5 - c
Posted on Mar 25, 2014 - 12:31 (UTC)
(A3 1.14) setLightAttenuation array will present fallowing visual effects:

[start(SCALAR), constant(SCALAR), linear (SCALAR), quadratic(SCALAR)]

start(SCALAR) – Number can be unlimited, this parameter determines the range that the light source takes effect. Terrain environmental color will be bathed by setLightAmbient within the range and its covered objects will reflect the color by setLightColor.

constant(SCALAR) – Support signed number, this parameter determines the brightness proportion of the light source, higher the number is, less the brightness will be, vice versa. Any minus value passed will be treated as 0 (100% brightness). In other words, this parameter is related with setLightBrightness and setLightIntensity.

linear (SCALAR) – Support signed number, effective range is from 0 ~ 100 (passed minus value will be treated as 0), this parameter determines the concentration of the light source, higher the number is, more will the light concentrate, vice versa. In other words, this parameter will turn the source into spotlight and sharpens its light circle border.
Please pay attention to a special value: 4.31918e-005
e.g.
// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten. _light setLightAttenuation [2, 4, 4.31918e-005, 0];

quadratic(SCALAR) – Support signed number (range unlimited, passed minus number will be treated as 0), this parameter determines the range that the light source is visible and its visual presentation looks similar to linear. 0 means the maximum visible range. In further explanation, a less bright source can’t be seen out of the range on the land but still visible on the sea, and a bright enough source won’t be effected by the passed range who is still visible out of the range.
Please pay attention to a special value: 4.31918e-005
e.g.
// This value will make the light source reach an ultra high effect range. Any initial param set before will be discarded and overwritten. _light setLightAttenuation [6, 0, 0, 4.31918e-005];