Dev:How Synfig Works

From Synfig Studio :: Documentation
Revision as of 16:36, 13 February 2009 by Yoyobuae (Talk | contribs) (Small explanation of the internals of Synfig)

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

Synfig-engine.png

The diagram shows more or less how Synfig is currently organized. "V" stands for valuenodes, "L" for layers, "BL" for blank layer (completely transparent layer default background), "BM" for blend method.

When Synfig needs to render a frame it starts by evaluating the valuenodes parameters of layers. If a valuenode is a Convert type then it evaluates its parameters. This process works recursively, going all the way down to the leaf nodes, calculating their value, then calculating the value of their parent, and so on until reaching the root of the node tree.

Note that valuenodes can be animated, meaning that they change value as animation time progresses. Since any leaf valuenode may have changed, the entire tree needs to be evaluated on each frame.

Once a layer has the values for it's parameters, it renders the intended shape or effect onto a raster. A raster is an array of pixels, each pixel with its color/opacity. It doesn't carry any information about the vector shapes that it's representing, only their pixel data.

Then comes blending. The raster result of the previous layers is combined with the current one according to the set blending method. Some layers (transforms, distortions, etc) just modify the raster result of the previous layers and pass that on to the next layer, instead of blending.

Note that a layer see all the layers underneath as a single combined raster. That layer cannot distinguish the pixel data that comes from the next layer that's underneath, from pixel data from any other layer that's underneath.