Canvas 3D - Light Tag

From CDOT Wiki
Jump to: navigation, search

Light Tag Reference

Back To XML 3D Main Page


The source of light in a 3D world can be one of many types. These types are limited to Ambient (a light source from all directions) and Diffuse (Light cast from one point in a direction).

Tag Attributes

  • number
    • Usage: <light number="3" />.
    • OpenGL handles many different lights at the same time and therefore requires an identifier to access them.
    • This number is restricted from 1 to 10.
  • type
    • Usage: <light type="diffuse" />.
    • This attributes specifies the type of light that will be created and the way it can be used.
    • The attribute only accepts the values of 'ambient' and 'diffuse'.
  • color
    • Usage: <light color="#FF00FF" />.
    • This determines the color of the light that is being cast on the object. This values should be in Hex format.
  • position
    • Usage: <light position="0.3, 0.6, 2.1" />.
    • The position attribute specifies the 3D location of the light source.
    • Three values must be specified as a 3D vector separated by commas.
  • orientation
    • Usage: <light orientation="4.1, 6.3, -2.8" />.
    • The orientation defines the direction the light source is pointing at.
    • This attribute only applies to Diffuse Lighting and is ignored if used in another case.
    • The default is {0.0, 0.0, 1.0} if omited.


  <light number="1" position="0.0, 0.3, 0.5" orientation="0.2, 0.6, 1.3" color="#0000FF" type="diffuse" />
  <light number="2" position="5.0, 3.3, 0.1" color="#FF00FF" type="ambient" />