Animating effects tutorial

From Serious Sam Wiki
Revision as of 20:41, 1 May 2016 by Innocentive (Talk | contribs) (typo)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This tutorial explains you can animate different effects.

Animating effects

When you want to animate (e.g. as an reaction to a level event) particles, postprocessing, distant/omni/spot lights, shader modifiers (floats like texture scroll/stretch/treshold and colors like base color, illumination etc.), flare or haze, you should use "Event Animator" entity.

It is container of the animations (editable trough graph control) that is commanded (e.g. started/stoped) from the script (line would be something like Animator:Start()).

Animator entity's container of animations is a resource that you have to share between event animator entity and entities that use it (e.g. distant light). You can do that in 2 ways: first is to make shared resource from the Event Animator container of animations (left-click on "Simple animator" property of the event animator entity and select "Share"). This way you don't have to save animations as a file on disk for this animator. If you choose to save it onto disk as a file (select "Save As" instead of "Share") you're sure to avoid all the possible problems (recommended).

Important:  You have to be very carefull with the shared resources because they are saved inside the level and

copying of the entity that uses share resource into another level would result in loading of the

original level (!). So, if you are not 100% sure what you are doing, save resources (in this case animations) as files.

Whatever path you take, you have to copy "Simple animator" property and paste it over the "Animator" property in entity that is using the animation (e.g. haze entity). Again, basic concept is that "Event Animator" entity gets animated trough lua script (e.g. animation is played/stopped) and other entities are "reading" animated values and apply them in their own context (e.g. dimming the distant light power or haze density etc). Note that event animator's value of 0 means that effect is not applied, and 1 means that effect is applied with full power or completly uses target value (in case of lights).


Example:  Simple level that shows many types of effects that are animated. File:EventAnimator.wld