Difference between revisions of "Adding a Light"

From Constructive Labs
Jump to navigation Jump to search
(add lighting effects)
(add spotlight features, Gobo)
Line 7: Line 7:
 
[[File:NewLight.png]]
 
[[File:NewLight.png]]
  
A spotlight is added
+
A new spotlight is added
  
 
==Type of Light==
 
==Type of Light==
Line 17: Line 17:
  
  
'''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)
+
'''SPOT''' - shines a cone of light in a specific direction.  
Set the AmbientColor to 0,0,0 so that only the cone of light is illuminated.
+
* SpotAngle - You can specify the angle of the diameter of the cone in degrees.  
DiffuseColor sets the color of the cone of light.
+
* 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.
 +
* ShadowCasting - enable shadows
 +
* SpotBlur - Blurs the edge of the circle that the spot projects. (set this by entering a value between 0 and 1)
 +
* GoboResourceLocator - add an image file that the spot will project. Specify the .jpg image file.
 +
* GoboEnabled - toggle the gobo projection on or off
 +
* GoboRotationAngle - rotate the image
 +
 
 
   
 
   
 
[[File:PointLight.png]]
 
[[File:PointLight.png]]

Revision as of 10:19, 3 October 2022

Adding a light

AddLight.png

Choose Spatial -> Lights -> light

NewLight.png

A new 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.

  • SpotAngle - You can specify the angle of the diameter of the cone in degrees.
  • 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.
  • ShadowCasting - enable shadows
  • SpotBlur - Blurs the edge of the circle that the spot projects. (set this by entering a value between 0 and 1)
  • GoboResourceLocator - add an image file that the spot will project. Specify the .jpg image file.
  • GoboEnabled - toggle the gobo projection on or off
  • GoboRotationAngle - rotate the image


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 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

Next: Adding Sound