Sunday, August 24, 2025

Procedural Texture Filter System Variables

 Affinity Photo's Procedural Texture Filter System Variables

x, y, rx, ry, w, h, pi

x is the horizontal pixel coordinate position beginning with 0 at the left edge of the document and increasing toward the right by 1 for each pixel.

y is the vertical pixel coordinate position beginning with 0 at the top edge of the document and increasing downward by 1 for each pixel.

rx and ry are relative pixel coordinates. These coordinates allow repositioning of the coordinate system in two ways. Double-clicking the mouse on the document moves the origin (0,0) to the current position of the mouse. Click and dragging moves the coordinate system from the current position to the position you drag it to.

w is the width of the document in pixels, ie 1024

h is the height of the document in pixels, ie 768

pi is the geometric constant 3.14159265...

RGBA inputs

R contains the pixel information for the red channel in the document. It is not possible to access current image pixels individually from this variable. It is possible to modify the image using the channel outputs.

G contains the pixel information for the green channel.

B contains the pixel information for the blue channel.

A contains the pixel information for the alpha channel.

If the document is in CMYK mode, the letters C, M, Y, and K represent the color pixel information for the document. Note that you won't be able to access your RGB filters if the document is set to CMYK color mode.

p cannot be used as a custom input or as a variable name. p followed by a digit may not be used as a custom input but may be used to define a var variable. This includes p1, p2a, p304, etc.

Variable names must begin with a letter may only consist of numbers and letters, and _ (underscore) characters. Upper and lower case letters are allowed and a1 is not the same variable as A1. Space is not allowed nor are other special characters.

A 1024 x 768 landscape document would have an x value ranging from 0 to 1024, with 0 just to the left of the first pixel and 1024 just to the right of the last pixel. A value of x centered on the first pixel would be .5.

Friday, August 22, 2025

Affinity Photo Procedural Texture Filter: Seigaiha

Seigaiha Pattern

  • var v=vec2(x,y)*a/w+vec2(of/2,of/4); // Coordinates with offset
  • var v1=fraction(v)-.5; // Mask 1 Coordinates
  • var m1=smoothstepn(.5-s1/10,.5+s1/10,length(v1))*osci(v.y); // Mask 1 Positive
  • var v2=fraction(v+vec2(0,.5))-.5;  // Mask 2 Coordinates
  • var m2=1-smoothstepn(.5-s1/10,.5+s1/10,length(v2))*osci(v.y-.5); // Mask 2 Negative
  • var v3=fraction(v+vec2(.5,.75))-.5; // Mask 3 Coordinates
  • var m3=1-smoothstepn(.5-s1/10,.5+s1/10,length(v3))*osci(v.y-.25); // Mask 3 Negative
  • m1*m2*m3*smoothosc(b*length(v1),s2) // Mask with lines