Reference:Light Group

From POV-Wiki
Revision as of 18:18, 16 December 2016 by Jholsenback (talk | contribs) (indexentries fixes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Light groups make it possible to create a union of light sources and objects, where the objects in the group are illuminated by the lights in the group or, if so desired, by the global light sources as well. The light sources in the group can only illuminate the objects that are in the group, this also applies to scattering media, and it must be included in the light group as well. Keep in mind that if the scattering media also has an absorption component, it will be affected by light sources that are not in the light group definition.

Light groups are for example useful when creating scenes in which some objects turn out to be too dark but the average light is exactly how it should be, as the light sources in the group do not contribute to the global lighting.

Syntax :

light_group {
  LIGHT_GROUP LIGHT  |
  LIGHT_GROUP OBJECT |
  LIGHT_GROUP
  [LIGHT_GROUP MODIFIER]
  }

LIGHT_GROUP LIGHT:
  light_source | light_source IDENTIFIER
LIGHT_GROUP OBJECT: 
  OBJECT | OBJECT IDENTIFIER
LIGHT_GROUP MODIFIER: 
  global_lights BOOL | TRANSFORMATION
  • To illuminate objects in the group with the light from global light sources, add global_lights on to the light group definition.
  • Light groups may be nested. In this case light groups inherit the light sources of the light group in which they are contained.
  • Light groups can be seen as a union of an object with a light_source and can be used with CSG.

Some examples of a simple light group:

#declare RedLight = 
light_source {
  <-500,500,-500>
  rgb <1,0,0>
  }

light_group {
  light_source {RedLight}
  sphere {0,1 pigment {rgb 1}}
  global_lights off
  }

A nested light group:

#declare L1 = 
light_group {
  light_source {<10,10,0>, rgb <1,0,0>}
  light_source {<0,0,-100>, rgb <0,0,1>}
  sphere {0,1 pigment {rgb 1}}
  }

light_group {
  light_source {<0,100,0>, rgb 0.5}
  light_group {L1}
  }

Light groups with CSG:

difference {
  light_group {
    sphere {0,1 pigment {rgb 1}}
    light_source {<-100,0,-100> rgb <1,0,0>}
    global_lights off
    }
  light_group {
    sphere {<0,1,0>,1 pigment {rgb 1}}
    light_source {<100,100,0> rgb <0,0,1>}
    global_lights off
    }
  rotate <-45,0,0>
  }

In the last example the result will be a sphere illuminated red, where the part that is differenced away is illuminated blue. The end result is comparable to the difference between two spheres with a different pigment.