easy · useful · affordable · amazing ·
visual effects plug-ins

Available for...
Premiere Pro (Windows)
After Effects (Windows)
Photoshop (Windows)
CyberLink PowerDirector (14/ltr)
Magix Movie Studio (2022/later)
Magix Video Pro X (X11/later)
VEGAS Pro (14/later)
VEGAS Movie Studio (14/later)
DaVinci Resolve (19/later)

AnyFX Effect Reference Guide


float g_fSize : PARAM
<
    string Name     = "Size";
    string UIType   = "slider";
    float2 UIRange  = {0.0f, 1.0f};
    float2 Bounds   = {0.0f, 4.0f};
    string UIHelp   = "Controls the overall blur power.";
> = 0.25;

Important: Always assign a default value to UI variables.


Allowed Types

  • int
  • float
  • float2
  • float3
  • float4
VariableAllowed ControlsRequiredOptional
intmenu, optionmenu requires UIItems
floatsliderprogress
float2slider, pointrequires UIItems 
float3slider, colorslider requires UIItems
float4slider, colorslider requires UIItemsrgb
Shared UI Annotations
AnnotationTypeDescriptionApplies ToExample
NamestringDisplay nameAll Controls string Name = "Size";
UIHelpstringTooltip textAll Controls string UIHelp = "Controls the overall blur power."
UIItemsstringItem namesmenu, slidersstring UIItems[] = {"HSL", "HSV"};

Required

string UIType = "slider";

Optional

AnnotationTypeDescriptionExample
UIRangefloat2Slider range{0.0f, 1.0f}
Boundsfloat2Editable numeric range{0.0f, 4.0f}

Required

string UIType = "color";

Optional

AnnotationValueDescription
UIControl"rgb"Hides alpha slider

Required

string UIType = "option";

Variable type must be int (0 = Off, 1 = On).

Declaring Inputs
texture inputStream : INPUTSTREAM0;
texture inputStream2 : INPUTSTREAM1; // for transitions

Declaring Output

texture output;

Temporary Textures

texture tTex1;

Important Rules

  • Do not use input textures as outputs or temporary textures.
  • All textures match project size/depth.
  • Each input texture must be paired with exactly one unique sampler state. Decoupled sampling or reusing a single sampler across multiple textures is not supported by this implementation.
  • Textures do not have mipmaps. Implement your own filtering if necessary.

Sampler Example


sampler2D sSrc = sampler_state
{
    Texture = <inputStream>;
    AddressU = ClampToEdge;
    AddressV = ClampToEdge;
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
};

Supported Sampler States

  • AddressU, AddressV -- ClampToEdge, Wrap, Mirror
  • MinFilter, MagFilter, MipFilter -- Linear, Point
  • Use Point filtering for per-pixel effects; Linear is usually better for geometric effects, distortions, and blurs.
Global Variables


To declare a global variable, simply define it outside of any function.

Note: Always Initialize global variables.

4.1 UI Parameters
  • Effect parameters are global variables.
  • You can access them directly in shaders.
  • Best practice: pass them as function parameters (see our programmers guide).
4.2 Automatic Variables
  • Automatic Variables are global variables and you can access them directly in shaders.
  • These variables have values computed by our engine.
  • To use some of these variables, declare them above all functions/shaders.

float 	a_fFrame = 0.0;
float 	a_fFrames = 30.0;
float 	a_fTimeStep = 0.033;
float 	a_fFPS = 30.0;
float 	a_fCompletion = 0.5;
float 	a_fTime = 0.0;
float 	a_fTTime = 1.0;
float 	a_fAspect = 1.0;
float2 	a_f2SizePixels = { 1920.0 , 1080.0 };
float2 	a_f2TileSizePixels = { 1920.0 , 1080.0 };
float2 	a_f2TileSize = { 0.0 , 0.0 };
float2 	a_f2TileOffset = { 0.0 , 0.0 };
float2 	a_f2PixelSize = { 0.001 , 0.001 };
float2 	a_f2AutoAspect = { 1.0 , 1.0 };
float2 	a_f2AutoRatio = { 1.0 , 1.0 };
float2	a_f2AutoPointSize = { 0.001 , 0.001 };
float2	a_f2MaxOffset = { 0.25 , 0.25 };
int 	a_nAlphaMode=0;
int 	a_nTiling = 0;
FieldTypeDescription
a_fFramefloatCurrent Frame (0 to a_fFrames-1.0)
a_fFramesfloatTotal Frames
a_fTimeStepfloat1.0/a_fFPS
a_fFPSfloatFrames Per Second
a_fCompletionfloata_fFrame/(a_fFrames-1.0)
a_fTimefloatCurrent Time
a_fTTimefloatTotal Time
a_fAspectfloatAspect Ratio
a_f2SizePixelsfloat2Size in Pixels
a_f2TileSizePixelsfloat2Tile Size in Pixels
a_f2TileSizefloat2a_f2TileSizePixels/a_f2SizePixels
a_f2TileOffsetfloat2Tile Offset (0.0 to 1.0)
a_f2PixelSizefloat21.0/a_f2TileSizePixels
a_f2AutoAspectfloat2float2( a_fAspect , both_fields ? 1.0 : 2.0 )
a_f2AutoRatiofloat2 
a_f2AutoPointSizefloat2 
a_f2MaxOffsetfloat2 0.5*f2OverlapPixels/a_f2TileSizePixels
a_nAlphaModeint0 - Straight Alpha, 1 - Premultiplied Alpha
a_nTilingint0 - Whole Image, 1 - Tiling
  • If tiling is Off a_f2TileSizePixels==a_f2SizePixels
  • These variables have values computed by our engine.

5.1 Shaders Shaders (specifically fragment/pixel shaders) are small, GPU-accelerated programs written in HLSL or similar languages that process images by manipulating pixels in parallel, often 10x and more faster than CPUs. They are ideal for various effects, such as filters, color adjustments, convolution kernels (blur/sharpen), and geometric transformations. GPUs run shader code on hundreds or thousands of cores simultaneously, allowing for fast manipulation of every pixel in a frame. The pixel shader is the primary tool for image processing, as it takes the texture coordinates of an image, fetches the color data, and calculates a new pixel color. Pixel shader outputs a color value — most commonly a 4-component vector representing RGBA.

float4 SimplePixelShader_PS( VS_OUTPUT vsin ) : COLOR0
{
	float4 color=tex2D( samplerSsource, vsin.Tex );
	//modify color here
	return saturate(color);
}
In CgFX and Effect formats, shaders can have parameters that allow you to reuse the same shader with different inputs and parameters.

float4 ShaderWithParameters_PS( VS_OUTPUT vsin , uniform sampler2D src , uniform float mul) : COLOR0
{
	float4 color=tex2D( src , vsin.Tex );
	color=color*mul;
	return saturate(color);
}
  • To reuse a shader, you will likely need to pass the shader input as a parameter.
  • Pass inputs as a samplers, not as textures.
  • Always use 'uniform' in parameter declarations.
5.1 Functions A function is a reusable block of code that shaders can call. Functions can be called from pixel shaders, vertex shaders, etc. A function requires a return type, a name, and parameters. You must define or declare a function before it is called—typically before the shader body.

// Example: A function to convert RGB to grayscale
float getGrayscale(float3 color) {
    return dot(color, float3(0.299, 0.587, 0.114));
}

float4 SimplePixelShader_PS( VS_OUTPUT vsin ) : COLOR0
{
	float4 color=tex2D( samplerSsource, vsin.Tex );
	color.rgb=getGrayscale(color.rgb);
	return saturate(color);
}

In CgFX and Direct3D Effect format, Techniques and Passes are organizational structures used within the system to manage complex rendering logic.
6.1 Techniques A technique is a high‑level container that groups one or more rendering passes to achieve a specific visual effect. In our engine, a technique encapsulates the entire pipeline state for a single rendering step. You can define multiple techniques within one file to build complex effects. For example:
  • Technique 1 blurs inputA
  • Technique 1 blurs inputB
  • Technique 3 combines the results
Techniques are executed in the order in which they are declared.
Additional rules:
  • You must declare which texture is used as the technique’s output.
  • You can skip a technique by defining a technique‑level condition.
  • The output of the last technique whose condition evaluates to TRUE (or has no condition) becomes the final effect output. Ensure that at least one technique meets this requirement.

technique Technique0
<
	string		output		= "tempTexture1";
>
{	
	pass Pass_0
	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf GenerateNoise_PS();
	}
};

technique Technique2
<
	string		output		= "tempTexture1";
>
{	
	pass Pass_0
	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf Blend_PS(samplerSource, sampler_tempTexture1, NoiseAmount);
	}

};
6.2 Passes A pass is a subset of a technique that defines a single rendering operation. Each pass typically contains:
  • Shader Assignments: Specific functions to be used for the VertexShader and PixelShader.
  • Shader function parameters.
  • You can control which pass is executed by defining a pass‑level condition.
  • All passes within a technique share the same output target, so only one pass should be active at a time.

technique Technique0
<
	string		output		= "tempTexture1";
	string		condition	= "BlurSize>0.0";
>
{	
	pass Pass_0
<
	string		condition		= "blurType==0";
>	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf BlurX_PS(samplerSource, BlurSize);
	}
};
technique Technique1
<
	string		output		= "tempTexture2";
	string		condition	= "BlurSize>0.0";
>
{	
	pass Pass_0
<
	string		condition		= "blurType==0";
>	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf BlurY_PS(sampler_tempTexture1, BlurSize);
	}
	pass Pass_1
<
	string		condition		= "BlurType==1";
>	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf BlurRadial_PS(samplerSource, BlurSize);
	}
};
technique Technique2
<
	string		output		= "tempTexture1";
>
{	
	pass Pass_0
<
	string		condition	= "BlurSize>0.0";
>
	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf Blend_PS(samplerSource, sampler_tempTexture2, BlendAmount);
	}
	pass Pass_1
<
	string		condition	= "BlurSize==0.0";
>	
	{
		VertexShader = compile glslv VS_Basic();
		PixelShader = compile glslf Blend_PS(samplerSource, samplerSource, BlendAmount);
	}
};
This example ilustrates a complex rendering logic using technique and pass conditions. Note how the second input to Blend_PS is produced through different paths:
  • If BlurSize==0.0 Blend_PS uses the source directly -- samplerSource -> Blend_PS
  • If BlurSize>0.0 and BlurType==1 -- samplerSource -> BlurRadial_PS -> tempTexture2 -> Blend_PS
  • If BlurSize>0.0 and BlurType==0 -- samplerSource -> BlurX_PS -> tempTexture1 -> BlurY_PS -> tempTexture2 -> Blend_PS
6.2 Conditions Conditions are statements that allow the execution of different techniques and passes based on certain criteria. Techniques or passes where they are defined are executed only if the condition is true. Conditions use Relational Operators to compare values:
  • == (equal to) and != (not equal to)
  • > (greater than) and < (less than)
  • >= (greater than or equal to) and <= (less than or equal to)
  • Note: Only scalar variables and constants can be compared. Types such as float2, float3, float4, or arrays are not allowed in conditions.