Dynamic shadows for RageSpline

RageShadow adds dynamic shadows and lighting effects to Unity's fabulous RageSpline extension.

How it works

RageShadow simulates lighting and shadows by modifying existing RageSplines. Each shadow is a common RageSpline with an additonal RageShadow component, parented to the object that casts the shadow. The RageShadow Component component links to a RageLight object and will modify the shadow spline to simulate a proper casted shadow. Additionaly, it can modify the shadow caster's gradient to simulate lighting.

To sum it up: each RageShadow object reacts to a single RageLight object.

The RageLight Component component defines general parameters like Light type, shadow color+alpha and how the shadow splines are z-positioned.

Watch the tutorial videos or read on for a detailed explanation of the two components.

RageLight component

Believe it or not, without lights you won't see shadows! So before creating shadow splines, you should create a GameObject and attach a RageLight component to it.

Light Type

Directional Light works like the builtin directional light, so rotate the RageLight object to set the light's direction. A yellow arrow will indicate the light direction in the scene view.

Shadows generated by a Point Light will take the RageLight position into account.

Offset From / Offset

Shadows are RageSplines, so their z-position must be set properly to work within your game setup.

Source will offset shadow's z from the shadow caster itself.

Background lets you select a transform (usually the background image/spline) to offset shadow's z-position from. This is useful if you want all shadows to share a certain z-layer, e.g. right in front of your background.

The Z-Offset determines the offset that will be used (in units)

Max Shadow Height

This parameter can be confusing first, but read on. If you set OffsetFrom to a background, RageShadows will use the shadow caster height from the background to alter the shadow offset, alpha and size. MaxShadowHeight will limit those height to a certain value. E.g. if your shadow caster is at (0,0,2) and your background is at (0,0,10), the height of the shadow caster over ground would be 8 units. A MaxShadowHeight value of 5 will ensure that a maximum distance of 5 units will be used to calculate the shadows position, scale and alpha.

This is most useful to if you want your objects' shadows look like the object is directly hovering over the ground, though in real the object z-position is far away from the background due game setup reasons.

If you set OffsetFrom to Source, shadow caster's height will always set to MaxShadowHeight, so only the Far-value of the following parameters will be taken into account only.

Near Scale / Far Scale

The scale of a RageShadow will be determined by the “height over ground” in the range of this values.

Shadow Color

The color of a RageShadow.

Near Alpha / Far Alpha

The alpha of a RageShadow will be determined by the “height over ground” in the range of this values.

RageShadow component


The RageLight this shadow reacts to.

Use local Color

Check to override the Shadow Color defined by the light and to use the local RageSpline fill color.

Gradient to Light

When checked, the shadow caster's gradient fill will be rotated to simulate lighting.

Auto Refresh Shadow

Check to automatically refresh the shadow spline if neccessary.

Auto Refresh Parent

Check to automatically refresh the shadow caster if neccessary.

Last modified: 2018/01/01 17:00 by Jake