Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

VRML File Structure
Drawing: Shape node
Geometry Nodes:
Example: Chessboard
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Let the Music Play
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes

;koHcC XF$+R q<@s;A` E6)ݲqj>DI-ۙ=2쪮n~ #5 [wOVٱAB o1R*]Ǚfv@=6ۋ'NawX]y,Q@Gh_4Doc;dPzksI{]\_b󠾟T*}Փ3(>p&(spqlN;#3yf*I7?Yj9=i5;oQ難VwuGǧm?AI@} ۝sZ>w'ˑ5tj_h5HЀ1͞pR;ѝS 笵[6/h$e۳֯l=8X7F:>+-M9^/#_@vA䏿X~ >0@jj2"ʑ~G}Vȁ_-x_wͶͯ1amD8 02٭RiGıW!;Ad (1$ Gi*%Ĭe ?]ynv#;"[Ͳ:eof_2,44}KNx W>IH]#dOpi >]7!wQ` \]bU*'T y%Mb7Oց`v bТTմ7 U$`Krb*[I/jIS5LjF /)^O)( 9LCKM<0:ǵtVkȄk`k +A|{ټ&H::*k8BtئI>bj,gU9۳GTZZ5J~͚z)}@#䲜Y!A\#$$Za룤bR[y]?$ (%fz!: |Hc~\ ^<ÂDn0ʄ;\Bʵ_`JJdRRId%o!P)J,IB؇/d& 7+>+ġ}hL udćZm xye$ S)hR + CU T!L$aY@&w/bn@,OLS\{ēty]@u[fĜ@h oY^@/φϡTf$*"6sg|&;N^~1ɤϡevj#<΃lSNR9s(;iu` \A;`_JT7p[nEfNGa, pEG@k+2A x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yej m$w$/ bZ!6B$"CI@9qP }BL^uD:ڔOG1`H;r̢HF <}O;vrh h+NYhāe1zdR`je#2 P_D!VsCLJFr%yO=*b6L&`^E0$]e6 ۱{ك_ӷ{ Sm9UKS8ҠQM+g{j:۷ܮ D< =(p$60XE(DI1},!>L4Ah24zZijKÓb1Rj5"]a%~].PYv`)cCšj5J%Mt͇1t@&~3G z]O@?qSxyboA0 аyȰA?&,O!-0ߡPQrdMat oy[hg-66Rޔ{elun_xc5Ɨ GhT=5CAM"=*C(L2Yh6AF 6h/2%麽2\0ap.ZS)XubuެJ%{ 63dؗbs&Qv&jtnNaނ*P*4{Y0j#YsW|\qe-٢ S_X:*+K3b˷ze=xN];wDnL-W VC^kzH_Qn+#EKpt,.FSheRiJ<![ȵaX1l+nEφB  L.aJo`nIrőyiCcħ,ӊBJwt]R{)z#И9k).wܣg©>]}:E`bb搻YꏳL!O0b0άxgu9-̦hMy-tmy޵}v=`dϧ9ǚ!'HRpD.0Β)fAo5?g >9{y߹;x ٻ&} Cc9V~uڋUĕm-h߄2[}kGNHܒ-Ѡ>a:"uK ж1`IV_~a?I"fGfd7cۧ16www[&n7fzKJ0q%Y 7m1nGXHZh75lnf¹

SpotLight Node

If you're new to lighting in VRML, there is a Lighting section in this tutorial which discusses general features of lighting in VRML. In here only the aspects which are particular to Spot Lights are discussed.

Spot Lights define a light source in a specified location pointed at a particular direction. The light rays from this type of light are constrained to the interior of a cone, the cone's apex coinciding with the light's location. The following figure attempts to define a Point Light graphically (the point where the light rays start is the light location.

The cone of light is defined by two fields: cutOffAngle and beamWidth. The cutOffAngle defines the angle of the cone, in radians. The beamWidth defines the angle of an inner cone within which the light intensity is constant. The light rays which fall between the inner cone and the outer cone have a decreasing intensity from the inner to the outer cone. If the beamWidth is larger than the cutOffAngle then the light has a constant intensity within the cone.

A Spot light lits all nodes regardless of their position in the file, i.e. this light is not scoped. There is however a way of limiting the volume which is lit by this light, one can specify a radius which defines the maximum distance that the light rays can travel. Objects which are further away from the light source than the radius, or lie outside the outer cone are not lit by the light source.

There is still another way to control the attenuation. Using the attenuation field one can specify how the light grows dimmer with distance, within the sphere defined by the radius.

The following fields are present in this node:
  • on specifies if the light is active. This is a boolean field.
  • intensity has values between 0.0 and 1.0. Higher values specify stronger lights.
  • ambientIntensity specifies how much this light contributes to the overall lighting .Values must be between 0.0 and 1.0
  • color is a RGB field to specify the color of the light.
  • location which specifies a vector in 3D defining the coordinates of the light in your world.
  • direction which specifies a vector in 3D defining the aim of the light.
  • attenuation is a 3D vector that specifies how the light looses its intensity as distance from the light source increases. All vector values must be greater than or equal to zero
  • radius specifies the maximum distance for the light rays to travel. Must be greater than or equal to zero.
  • cutOffAngle specifies the cone within which the light rays are constrained. Must be greater than or equal to zero, and less than or equal to 180 degrees, approximately 1.57 radians.
  • beamWidth specifies an inner cone within which the light rays have a uniform intensity . Must be greater than or equal to zero, and less than or equal to 180 degrees, approximately 1.57 radians.

  • Syntax:
    SpotLight {
    on TRUE
    intensity 1
    ambientIntensity 0
    color 1 1 1
    location 0 0 0
    direction 0 0 0
    attenuation 1 0 0
    radius 100
    cutOffAngle 0.78
    beamWidth 1.57

    Note: Due to the default location and direction of the Spot Light the initially loaded world is black. On the VRML world presented as example the sphere is placed at -2.5 0 0, the cone is placed at the origin, and the cylinder is placed at 2.5 0 0. If you're not familiar with placing shapes other than at the origin see the Transform node.