More light model functions... beyond getAbsorbedPower

So far, we only used the light model to obtain the amount of absorbed power for the objects within our scene, but there is more :)

Node: The following is only implemented for the CPU-based twilight light model of GroIMP and NOT implemented for the GPU-based Flux light model.

The twilight light model offers further functions, e.g., to obtain the received and transmitted power.

The following code will create a simple scene containing only one flat box on the ground, functioning as test object for now, and a directional light source directly above of it, facing straight downwards.

protected void init () [
Axiom ==>  
  // green ground
  [Null(0,0,0) Box(0.01,1,1).(setShader(GREEN))]
 
  //light
  [
    Null(0,0,1) RU(180)
    LightNode.(setLight(new DirectionalLight().(setPowerDensity(100))))
  ];
 
  {
    clearConsole();
    derive();
    LightModel LM = new LightModel(10000, 5);
    LM.compute();
  }
 
  x:Box ::> {
      println("received = "+LM.getReceivedPower(x).integrate() +" = "+ LM.getReceivedPower(x),0x000000);
      println("reflected = "+LM.getReflectedPower(x).integrate() +" = "+ LM.getReflectedPower(x),0x00ff00);
      println("transmitted = "+LM.getTransmittedPower(x).integrate() +" = "+ LM.getTransmittedPower(x),0x000000);
      println("absorbed = "+LM.getAbsorbedPower(x).integrate() +" = "+ LM.getAbsorbedPower(x),0xff00ff);
      println("hit ount = "+LM.getHitCount(x),0x0000ff);
 }
]

When the code is saved, it generates the scene and directly calls the light model and obtains the set of properties of the box object, including

The output of the code is given below:

As expected for a green object and a pure white light source, we see that green is totally reflected while red and blue are totally absorbed. Since we have not defined any transparency for the box, the transmitted part is empty.

As usual, the properties can be obtained for the three colour channels induvially or integrated using the integrate() function.

Note: For white light, the obtained values should reflect the settings of the used shader - for objects which have received most direct light. When the scene is getting more complex and several reflections involved, and therefore the input light is not white anymore, the results will become a combination of the whole incoming radiation.