Lighthouse3d.com

VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance Let there be 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 Example: Proximity sensor
Interpolators Let the Music Play Bindable Nodes
 Who Am I: NavigationInfo Where Am I: ViewPoint

;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"M cR-.h,iXl̼*E#2ɗmU-Vj:YKvh ]!=l&w#apsђmݒXa;Ϫ<~ /TŸf'-0|?xc"-%~;ۻ7\$)~ Xamta5fHj[ܶ&XC>U|p5&kz\7ŧşkT'iqb\'}zpLp +/sDoڡ WW]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{j:۷ܮ D< =(p\$60XE(DI1},!>L4Ah24zZĳKÓ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.