Introduction to Layers

From Synfig Studio :: Documentation
Jump to: navigation, search


Synfig, like most every other competent graphics program, breaks down individual elements of a Canvas into Layers. However, it differs from other programs in two major ways:

  1. An individual layer in Synfig usually represents a single "Primitive". ie. a single region, an outline of a region, an imported JPEG, etc... This allows you to have a great deal of flexibility and control. It is not uncommon for a composition to have hundreds of layers (organized into a hierarchy for artist sanity of course).
  2. A layer can not only composite information on top of the image below it, but also distort and/or modify it in some other way. In this sense, Synfig Layers act much like filters do in Adobe Photoshop or The GIMP. For example, we have a Blur Layer, Radial Blur Layer, Spherical Distortion Layer, color-correct layer, bevel layer, etc...

There are basically three types of layers:

  1. Layers that add content. Usually called primitives. They are mainly grouped into the Geometry group of layers but there are others that just add content to the canvas and aren't real primitives (Text, Plant, Metaballs etc.). Those layers can produce content without any layer below them just using the composite blend method.
  2. Layers that add content but based on the layers that are below it. Those layers take the render result that are below them, and performing a transformation, filter or whatever, produce a modified version of the [[Doc:Context|context]] and then composite the result over it using the blend method of the layer. Example layers of that type are: Blur layer, Shadow layer, Bevel layer, etc. They cannot produce any content if there are not any layer below it.
  3. Layers that doesn't add content, just replace the render of the context by a transformed version of it. Layers of this type need a context to modify it and replace in the current canvas context. They are called Doc:Filters or Doc:Transformations. Examples of those layers ate the Color Correct layer, Rotate layer, Zoom layer, etc.

Each layer has a set of parameters which determine how it behaves. When you click on a layer (either in the canvas window, or in the Doc:Layers Panel), you will see its parameters in the Doc:Params Panel.

How does it works

When Synfig or Synfig Studio renders the stack of layers the procedure is the following:

  1. The layer ask the context to render itself. The context is asked to be rendered with certain parameters in which it is included the time to render.
  2. Once the context renders itself there are three alternatives:
    • The layer renders its primitive based on its own parameters and composite the result with the context producing a new context for the upper layer.
    • The layer get the context result and modify it with certain parameters and then composite it against the context itself producing a new context for the upper layer.
    • The layer get the context result, modify it and replace the context by the modification the layer did, creating a new context for the upper layer.

So if there are for example, four layers (A,B,C,D) the sequence is like this: Layer A ask layer B to be rendered, which ask layer C to be rendered which ask layer D to be rendered. As layer D hasn't any layer below it render itself against a empty context (transparent) producing a context for the layer C. Layer C gets the context and produce a new context for the layer B according to its render rules. Same for B to A.

This is the list of all the layers available in Synfig.