User Tools

Site Tools


tutorials:light-modeling-light-sources

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:light-modeling-light-sources [2025/01/11 20:03] – created MHtutorials:light-modeling-light-sources [2025/06/02 19:09] (current) MH
Line 51: Line 51:
 ===== SpotLight ===== ===== SpotLight =====
  
-As a specialization of a //PointLight//, the //SpotLight// emits only light rays within a define opening angle.+As a specialization of a //PointLight//, the //SpotLight// emits only light rays within a define opening angle.  
 + 
 +To control the opening angle of the //SpotLight//, two functions are used: to set the inner angle, the 'core' of the spot light, the function //setInnerAngle// is used, and to set the outher angle, that describes the maximal outer, weaker radius of the spot light, the function //setOuterAngle// is used.  
 + 
 +<code java> 
 +protected void init () [ 
 +  Axiom ==>  
 +    LightNode.(setLight(new SpotLight().( 
 +      setInnerAngle(0.2), setOuterAngle(0.5), 
 +      setVisualize(true), 
 +      setNumberofrays(150), 
 +      setRaylength(0.5) 
 +    )))  
 +  ; 
 +
 +</code> 
 + 
 +Below, the effect of different inner and outher angles can be seen: 
 + 
 +{{ :tutorials:spotlightangles.png?direct&600 |}} 
 + 
 +Note: Make sure that the values for the inner angle do not extend the outer angle.
  
 ===== DirectionalLight ===== ===== DirectionalLight =====
Line 59: Line 80:
 ===== AreaLight ===== ===== AreaLight =====
  
-tbd+An area light can be created using a parallelogram as base and transforming it to a light source. It will cast a diffuse distribution in the positive direction of the local z-axis of the parallelogram. Note, as for now, it does not (yet) support user defined physical light distribution. 
 + 
 +<code java> 
 +module AreaLamp extends Parallelogram() { 
 +  { 
 +    setLight(new AreaLight().(setPower(100))); 
 +    setLength(1); // 1m 
 +    setAxis(0.5f, 0, 0); 
 +  } 
 +
 +</code>
  
 ===== PhysicalLight ===== ===== PhysicalLight =====
  
-tbd+Please refer to [[tutorials:basic-spectral-light-modeling#light_sources|Spectral Light Modelling]] tutorial. 
 + 
 + 
 +===== Light colour ===== 
 + 
 +To define the colour of the emitted light source, the function //setColor// can be used. It expectes an object of //RGBColor// type as input argument, that itself expects a triple of red, green, and blue values in the range of zero to one. E.g., to get a red light source one needs to add //setColor(new RGBColor(1,0,0))// to the list of settings for a light node. 
 + 
 +<code java> 
 +protected void init () [ 
 +  Axiom ==>  
 +    LightNode.(setLight(new SpotLight().( 
 +      setVisualize(true), 
 +      setNumberofrays(150), 
 +      setRaylength(1.1), 
 +      setColor(new RGBColor(1,0,0)) 
 +    ))); 
 +
 +</code> 
 + 
 +{{ :tutorials:light_node_colour.png?direct&400 |}} 
  
  
tutorials/light-modeling-light-sources.1736622210.txt.gz · Last modified: 2025/01/11 20:03 by MH