Adding a Light

From Constructive Labs
Revision as of 17:25, 3 September 2022 by Gmeader (talk | contribs)
Jump to navigation Jump to search

Adding a light

AddLight.png

Choose Spatial -> Lights -> light

NewLight.png

A spotlight is added

Type of Light

LightProperties.png

In the Property Editor for the light, you can choose 4 different types of lights (the default is a spotlight) and set the color and intensity (attenuation) and aimed direction (rotation) of a light


SPOT - shines a cone of light in a specific direction. You can specify the radius of the cone. Its intensity fades out (falloff) over distance. Adjust the amount of falloff with the third Attenuation value (set this by entering a value between 0 and 1) Set the AmbientColor to 0,0,0 so that only the cone of light is illuminated. DiffuseColor sets the color of the cone of light.

PointLight.png

POINT - shines in all directions, from its location, like a light bulb. Same falloff as a spotlight.

DirectionalLight.png

DIRECTIONAL - shines parallel rays like the sun. It does not fade out over distance

AmbientLight.png

AMBIENT - illuminates from all directions, sort of like from the sky acts like a huge light. It does not fade out over distance.

Color of light

  • Ambient lighting: even when it is dark there is usually still some light somewhere in the world (the moon, a distant light) so objects are almost never completely dark. To simulate this we use an ambient lighting constant that always has the object reflecting some color.
  • Diffuse lighting: simulates the directional impact a light object has on an object. This is the most visually significant component of the lighting model. The more a part of an object faces the light source, the brighter it becomes.
  • Specular lighting: simulates the bright spot of a light that appears on shiny objects. Specular highlights are more inclined to the color of the light than the color of the object.

Lighting.png

The ambient light is usually set to a low intensity because we don't want the ambient color to be too dominant. The diffuse component of a light source is usually set to the exact color we'd like a light to have; often a bright white color. The specular component is usually kept shining at full intensity. All three combine to become Phong reflection

Color of materials

In the real world, each object has a different reaction to light. Steel objects are often shinier than a clay vase for example and a wooden container doesn't react the same to light as a steel container. Some objects reflect the light without much scattering resulting in small specular highlights and others scatter a lot giving the highlight a larger radius.

The ambient material defines what color the surface reflects under ambient lighting; this is usually the same as the surface's color.

The diffuse material defines the color of the surface under diffuse lighting. The diffuse color is (just like ambient lighting) set to the desired surface's color.

The specular sets the color of the specular highlight on the surface (or possibly even reflect a surface-specific color). Lastly, the shininess impacts the scattering/radius of the specular highlight.

Materials.png

Example materials settings: http://devernay.free.fr/cours/opengl/materials.html

Lighting notes

Divided into several categories; LightingEffects; TextureEffects, ProjectiveTextures and support for custom materials and shaders

Texture Effects

  • Support for emissive textures.. This is a texture map that, when enabled, causes the display of the color in the map at the surface point; scaled by a float amplifier. Net effect: oversaturated glowing materials like lava.
  • Support for ambient occlusion map. This is a texture (B&W) that is computed by most modeling packages based on a more complex lighting calculation. All that this does is reduce the brightness of the pixel in question. Most modeling packages can now emit these. Note: not SSAO (screen space ambient occlusion) - this is slow. In this case, this is just another texture map, but it trims the illumination
  • Debug existing specular and displacement maps - these are not being picked up in importer, but can now be specified manually in the material.

Lighting Effects

ProjectiveTextures

  • ProjectiveTextures aka “Gobos” - uses a gobo at distance d and rotation r from a light along the light direction. Add the contribution of this texture to the surface. Might want to add an angular term for 180o. 360o can just be two lights back to back
  • Mirror.water surface - render from POV of mirror and map to surface

Custom materials

  • add support for any data values to materials
  • Materials become a map with arbitrary values that can be picked up by shaders
  • Template system for shaders (takes vars from shader and makes template)
  • Selection of surface shaders (water, etc)

Next: Adding Sound