Compositor: Difference between revisions

3,244 bytes added ,  7 November 2019
no edit summary
No edit summary
No edit summary
Line 87: Line 87:
The Compositor introduces a new way of defining lights that is renderer agnostic, so every rendering pipeline will be able to access the lights that have been implemented like this. As of 2019/11, the only pipeline that supports dynamic lights is the ALS pipeline.
The Compositor introduces a new way of defining lights that is renderer agnostic, so every rendering pipeline will be able to access the lights that have been implemented like this. As of 2019/11, the only pipeline that supports dynamic lights is the ALS pipeline.


{|cellpadding=20|
|valign=top|
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<light>
<light>
Line 124: Line 126:
     <q>0.032</q>
     <q>0.032</q>
   </attenuation>
   </attenuation>
   <spot-exponent>5</spot-exponent>
   <exponent>5</exponent>
   <spot-cutoff>40</spot-cutoff>
   <cutoff>40</cutoff>
   <range-m>50</range-m>
   <range-m>50</range-m>
</light>
</light>
</syntaxhighlight>
</syntaxhighlight>
|valign=top|
* <tt>'''name'''</tt>. An <code><animation></code> will be able to reference the light by this name. Most animations will work as expected (rotate, translate, spin etc).
* <tt>'''type'''</tt>. <tt>spot</tt> or <tt>point</tt>.
* <tt>'''position'''</tt>. The position of the light source in model space and in meters.
* <tt>'''direction'''</tt>. Only available in <tt>spot</tt> lights. It indicates the direction of the spotlight. This parameter can be specified in three different ways:
{| class="wikitable" style="padding: 20px"
! scope="col" style="width:33%;" |Direction vector
! scope="col" style="width:33%;" |Look-at point
! scope="col" style="width:33%;" |Rotation angles
|-
| style="padding: 10px" | A vector in model space that specifies the direction. Doesn't have to be normalized.
<syntaxhighlight lang="xml">
<x>-1.0</x>
<y>0</y>
<z>-0.013</z>
</syntaxhighlight>
| style="padding: 10px" | The spotlight will calculate its direction by looking at this position from the light position. The point is in model space and in meters.
<syntaxhighlight lang="xml">
<lookat-x-m>-8.031</lookat-x-m>
<lookat-y-m>0</lookat-y-m>
<lookat-z-m>-2</lookat-z-m>
</syntaxhighlight>
| style="padding: 10px" | A three angle rotation in degrees that rotates the spotlight around the three axes. A 0 degree angle in all axes makes the spotlight point downwards (negative Z).
<syntaxhighlight lang="xml">
<pitch-deg>90</pitch-deg>
<roll-deg>0</roll-deg>
<heading-deg>0</heading-deg>
</syntaxhighlight>
|}
* <tt>'''ambient'''</tt>, <tt>'''diffuse'''</tt> and <tt>'''specular'''</tt>. Four-component vectors that specify the light color.
* <tt>'''attenuation'''</tt> ('''Optional'''). Three-component vector where <code><c></code> specifies the constant factor, <code><l></code> specifies the linear factor and <code><nowiki><q></nowiki></code> specifies the quadratic factor. These factors are plugged into the OpenGL light attenuation formula [[File:Spotlight_attenuation.png]] where d is the distance of the fragment to the light source. If no attenuation has been specified, the inverse-square law will be used. See this [http://wiki.ogre3d.org/tiki-index.php?page=-Point+Light+Attenuation table] for a list of attenuation values based on the range of the light.
* <tt>'''range-m'''</tt> ('''Optional'''). Maximum range from the light source position in meters. This value will be used by the renderers to determine if a fragment is illuminated by this source. Every fragment outside this range isn't guaranteed to be affected by the light, even if the attenuation factor isn't 0 in that particular fragment. If no value has been specified, it will be calculated automatically based on the attenuation.
* <tt>'''cutoff'''</tt>. Only available in <tt>spot</tt> lights. It specifies the maximum spread angle of a light source. Only values in the range 0 90 and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the fragment being lighted is greater than the spot cutoff angle, it won't be lit.
* <tt>'''exponent'''</tt>. Only available in <tt>spot</tt> lights. Higher spot exponents result in a more focused light source, regardless of the spot cutoff angle.
|}


== Pipelines ==
== Pipelines ==
342

edits