TG Virtual Light

PARAMETERS

Listing :

  Shadow Area Brightness
  Lit Area Brightness
  Shadow Angle
  Lit Angle
  Intensity
  Light Distance
  Point Light
  From Camera
  Fall Off Distance
  Fall Off Final Intensity
  Squared Fall Off
  Light Position
  Shadow Colour
  Light Colour

Shadow Area Brightness

Range : -10 to 10

The areas facing away from the virtual light are classed as being in shadow. You can set the intensity of the lighting in the shadow area using this parameter.

Varying the Shadow Intensity parameter.

Varying the Shadow Intensity parameter.

This image shows 3 spheres painted with TG Virtual Light, and with no trueSpace light sources. The left sphere shows the default settings (Shadow Area Brightness of 0), the middle sphere has Shadow Area Brightness of 0.25, and the right sphere has a Shadow Area Brightness of 0.5.

Lit Area Brightness

Range : -10 to 10

The areas facing toward the virtual light are classed as being lit. You can set the intensity of the lighting in the lit areas using this parameter. This is the same as increasing the intensity on a conventional light.

A Note About Negative Brightness

You can set both Shadow and Lit Area Brightness to negative values. These will have no visible effect when the shader is used on its own, but when used as a layered shader, it allows similar effects to setting a negative light intensity with trueSpace lights - that is, the light then removes illumination rather than adds it. This means that a shadow colour of red with a negative Shadow Area Brightness will remove the colour red from the trueSpace illumination in the shadowed area of the virtual light.

Shadow Angle and Lit Angle

Range : -10 to 10

These parameters define the angles (actually, the cosine of the angle between the surface normal and the light source) at which the illumination reaches the Shadow Area Brightness and the Lit Area Brightness. 1 represents directly facing the light source, 0 represents right angles to the light source, and -1 is facing directly away from the light source.

Note that values above 1 and less than -1 are allowed, so that you can control the blending of the illumination.

The image on the right shows 3 spheres painted with TG Virtual Light and rendered with no trueSpace lights. The middle sphere has the default values (Shadow Angle of -1).

The left sphere has a Shadow Angle of -1.5, allowing the illumination to stretch further around the object (rather like hemispheric lighting).

Varying the Shadow Angle parameter.

Varying the Shadow Angle parameter.

The right sphere has a Shadow Angle of 0, resulting in the Shadow Intensity being reached when the surface is at right angles to the light source.

Varying the Lit Angle parameter.

Varying the Lit Angle parameter.

This image shows the Lit Angle parameter being varied. Again, the centre sphere has the default values (Lit Angle of 1).

The left sphere has a Lit Angle of 0.5, so that the maximum illumination reaches further around the object.

The right sphere has a Lit Angle of 1.5, so that the maximum intensity (set by Lit Area Brightness) is never actually reached.

Intensity

Range : 0 to 100

This controls the overall intensity of the illumination calculated by the shader. It acts as a multiplier for both Shadow Area Brightness and Lit Area Brightness. This allows you to control the strength of the effect when the shader is layered, without having to continually adjust both Brightness settings.

Light Distance

Range : 0 to 100

The position of the light in the 3D world is set using Light Position. However, the ShaderLab colour parameters only allow for values up to (10,10,10). Using the Light Distance parameter, you can multiply the values set in Light Position, to move your light source further away. It’s also a handy way of shifting the light source once you have the angle set using Light Position, without having to recalculate the individual x, y and z values to get the new position!

Values greater than 1 will scale the light further away, and values of less than 1 will scale the light closer.

Point Light

Range : Off or On

When unchecked, the shader uses an Infinite type light source. When checked, the shader uses a Point type light source (also called a local light). The differences are the same as what you would expect from a conventional trueSpace light source.

The image on the right shows a plane viewed from overhead, with Point Light checked (and Intensity set to 3). With it unchecked, the plane would be illuminated by a uniform intensity.

Using a Point Light setting.

Using a Point Light.

From Camera

Range : Off or On

When unchecked, the shader uses the light position as defined in the Light Position parameter. When checked, the shader takes the light’s position from the camera position (for a Point Light, this results in a point light which follows the camera’s position; for an Infinite Light, the light is taken as pointing from the camera’s location to the origin).

Fall Off Distance, Fall Off Final Intensity and Squared Fall Off

NOTE : Fall off settings only have an effect when the shader is set to use a Point Light.

Range : Fall Off Distance : 0 to 100
            Fall Off Final Intensity : 0 to 100
            Squared Fall Off  : On or Off

Unlike native trueSpace lights, a virtual light gives you more control over the fall off (how the intensity changes with distance from the light source).

The Fall Off Distance parameter allows you to set the distance at which the illumination becomes fully multiplied by the Fall Off Final Intensity. Note that the angle effects are calculated first, and the resulting intensity is multiplied by the fall off values, so that the fall off works in conjunction with the angle effects.

Increasing the Fall Off Distance will mean that the illumination reaches further afield through the 3D scene. Decreasing it will mean that the illumination falls off more rapidly.

The Fall Off Final Intensity controls the intensity reached at the Fall Off Distance. If this is set to 1, then no fall off effects occur (the processing is turned off too, to optimise the speed of the calculations). If set to less than 1, then at the Fall Off Distance the illumination becomes less, and at 0 it becomes completely black.

Note that the Fall Off Final Intensity can be set to greater than 1 for unusual effects, as then the illumination actually increases with distance from the light source.

Finally, if Squared Fall Off is checked, then the light intensity will vary with the square of the distance from the light source, rather than just linearly with the distance if Squared Fall Off is not checked. Note that Squared Fall Off can require the Fall Off Distance to be increased, as it can dampen the illumination significantly!

Linear Fall Off Examples :

The following 2 images use a Fall Off Intensity of 0

Point Light, Fall Off Distance 8.5

Fall Off Distance of 8.5

Point Light, Fall Off Distance 10

Fall Off Distance of 10

The following 3 images use a Fall Off Distance of 8.5

Point Light, Fall Off Intensity 0.25

Fall Off Intensity 0.25

Point Light, Fall Off Intensity 0.5

Fall Off Intensity 0.5

Squared Fall Off Comparison  :

Point Light, Fall Off Intensity 10

Lit Area Brightness 0.1,Fall Off Intensity 10

The following 2 images use a Light Position of (0,0,2), and a Fall Off Intensity of 0

Point Light, Linear, Fall Off Distance 4

Linear, Fall Off Distance of 4

Point Light, Squared, Fall Off Distance 16

Squared, Fall Off Distance of 16

Light Position

Range : -10 to 10 (for each of the x, y and z parameters)

For a Point Light, this parameter determines the co-ordinates of the light’s position in space. Note that if you set the position to be inside the object, this will affect the lighting (the points on the object’s surface will be facing away from the light source, so all of the angles will be negative). Remember that you can alter the Light Position for Point Lights by using the Light Distance parameter to move the light nearer or further away, but retaining the same relative angle between the object and the virtual light.

Some examples of varying the Light Position for a Point Light are shown below :

Point Light, Position (0,0,2)

Light Position (0,0,2)

Point Light, Position (0,0,5)

Light Position (0,0,5)

Point Light, Position (2,2,2)

Light Position (2,2,2)

For an Infinite Light, this parameter sets the vector of the light (the direction the light is coming from). Note that since this represents a vector (direction) rather than a position in space, the light cannot be classed as “inside” the object (unlike the Point Light). Also, the Light Distance will have no effect (it simply makes the vector longer, but it still represents light coming in from the same angle). Some examples of Light Position with an Infinite Light follow :

Infinite Light, varying the Light Position parameter

Light Position (2,0,2), Light Position (0,0,2), Light Position (0,2,2)

Shadow Colour and Light Colour

Range : RGB values

These set the colour of the shadow (unlit) areas and the colour of the lit areas.

Varying Shadow and Light colours

Varying the Shadow and Light colours (note the Shadow Intensity was raised to 0.3 for the coloured spheres, to make the colours more apparent).

TG Virtual Light Intro

TG Virtual Light Parameters

TG Virtual Light Tips

TG Virtual Light FAQ

TG Virtual Light Samples

TG Pack Index