Deprecated: Function set_magic_quotes_runtime() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/common.php on line 33 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/auth.php on line 95 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/common.php on line 743 dev:lightsources [DokuWiki]
 
Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/parser.php on line 142 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/parser.php on line 690 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/parser.php on line 690 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/parser.php on line 690 Deprecated: Function split() is deprecated in /storage/content/76/1004576/wiki.jpatch3d.org/public_html/inc/parser.php on line 690

Lightsources

Some thoughts about lightsources

Colors should be clamped to RGB values between 0 and 1. The color values will be pre-multiplied with the intensity value before being exported to a renderer.

Directional light

Simulates lightsources at an infinite distance.

Parameters:

  • Vector3d direction
  • Color3f color
  • double intensity
  • double size (for spherical area-lights, in degrees)
  • boolean shadows
  • boolean highlights

Point Light

Simulates point lightsources.

Parameters:

  • Point3d position
  • Color3f color
  • double intensity
  • double exponent 0 = no falloff, 1 = linear falloff, 2 = quadratic falloff (realistic), 3 = cubic falloff,…
  • double distance (the distance from the light where the intensity is equal to the specified intensity)
  • double size (for spherical area-lights, in units)
  • boolean shadows
  • boolean highlights

Spot Light

Simulates a spotlight.

Parameters:

  • Point3d position
  • Vector3d direction
  • Color3f Color
  • double intensity
  • double exponent 0 = no falloff, 1 = linear falloff, 2 = quadratic falloff (realistic), 3 = cubic falloff,…
  • double distance (the distance from the light where the intensity is equal to the specified intensity)
  • double radius (angle in degrees)
  • double falloff (angle in degrees, must be greater than radius)
  • double size (for spherical area-lights, in units)
  • boolean shadows
  • boolean highlights

NOTE: The model described above was taken from POV-Ray: The light intensity stays constant between 0° and radius, and then falls of linearly until the angle reaches falloff. The OpenGL model on the other hand uses the cosine of the angle (which is the result of the dot-product, so it’s already computed) to simulate falloff. This value can be raised to a power to controll the hardness of the spotlight. This approach is maybe more realistic and is also used in RenderMan’s defaut SpotLight shaders, so I think I’ll change it to be more RenderMan and OpenGL compatible.

Other features

Just for discussion:

  • A “projected through” image-map for fast shadows (e.g. to quickly fake shadows from off-screen objects like sunblinds, leaves, etc.) for all lightsources.
  • Light-groups with full control per lightsource over which objects can cast shadows and which objects can receive shadows (e.g. implemented as a 2D array of objects) and which objects will receive highlights (implemented as a list of objects).
  • Different colors/intensities per “channel” (ambient, diffuse and specular)
  • Contributions of point and spotlights to the ambient level (e.g. with a falloff), i.e. the ambient level would be higher close to lightsources, independent of shadows or light-source direction.
  • Non RGB lights, e.g. to simulate objects “glowing” in UV light.
  • Negative lightsources (can be easily implemented using negative intensities if the renderer does allow negative color values).
 
  dev/lightsources.txt · Last modified: 2005/11/22 10:45