# Difference between revisions of "Warp Layer"

 Language: English • русский

## Introduction

Warp layer is a simple but powerful distortion layer. In a few words it takes a rectangular portion of the resulting render of the layers that are behind it and maps the four corners of the rectangle to other four arbitrary points in the plane. It is a 2D -> 2D transformation.

## Warp Layer parameters

Those are the parameters of the Warp Layer:

• Source TL (vertex): It is the Top Left corner of the source that is going to be mapped.
• Source BR (vertex): It is the Bottom Right corner of the source that is going to be mapped. With those two vertices is defined the Source rectangle.
• Destination TL (vertex): It is the Top Left corner of the destination where the source is going to be mapped.
• Destination TR (vertex): It is the Top Right corner of the destination where the source is going to be mapped.
• Destination BL (vertex): It is the Bottom Left corner of the destination where the source is going to be mapped.
• Destination BR (vertex): It is the Bottom Right corner of the destination where the source is going to be mapped.
• Clip (boolean): When checked it only renders the destination pixels when they lie inside the destination quadrilateral.
• Horizon (Real): For infinite layers (gradients, chequerboard, etc.) it define where to stop rendering the points of the vanishing point. From 0.0 to 1.0 it renders all the points that are backwards on the perspective (in opossite direction to the vanishing point). From 1.0 to +infinite it renders the points that go in the same direction of the vanishing point. High value of Horizon makes synfig to spend a lot of time to render and the result is slightly visible better.

## Some Samples

Here there are a sample images of the resulting of apply the warp layer over a chequerboard layer.

Before distortion:

The ducks of the warp layer:

The resulting distortion (horizon = 15.0 and Clip = off):

You can see that the rendered horizon is the resulting line of connect the two vanishing point of the perspective distortion. In this case there are two vanishing points given by the intersection of the lines that connects the following points:

• Intersection of the line that passes by Destination TL point and Destination TR point with the line that passes by Destination BL point and Destination BR point. It gives vanishing point V1 (not shown in the diagram because it is outside the visible area).
• Intersection of the line that passes by Destination TL point and Destination BL point with the line that passes by Destination TR point and Destination BR point. It gives vanishing point V2

Connecting the Vanishing points V1 and V2 gives the horizon line.

See the diagram:

To understand how the parameter Horizon works see this animated image. It moves the Horizon parameter from 0.0 to 30 in four seconds. Notice how far does it go from backwards to the bottom of the warp destination quadrilateral and how takes several time to reach the horizon.

## The Clip parameter

This image shows what you will get when check it on.

 Language: English • русский