9.21 Mask
On this page:
9.21.1 Parameters
9.21.2 Examples
9.21.2.1 Mask example

9.21 Mask

The Mask effect is an extended version of FragmentProgram effect. Please make sure you’ve understood how the FragmentProgram effect works before reading about this effect.

The Mask effect allows you to load an image file and make it interact with your picture by using a fragment program. For example, you could use the Mask effect to make gradient fades or make some really nice bump mapping effect.

9.21.1 Parameters

 

Parameters

 

Default

 

Range    

 

Description

 

Path

 

""

 

n/a

 

The full path of the mask filename

 

 

 

 

 

ProgramString

 

""

 

n/a

 

The fragment program string

 

 

 

 

 

NumParams

 

0

 

(0 - 16)

 

The number of parameters we are specifying. There is a mechanism where you can send data from the muse code to the fragment program

 

 

 

 

 

r0

 

0.0

 

n/a

 

The value of parameter r0

 

 

 

 

 

g0

 

0.0

 

n/a

 

The value of parameter g0

 

 

 

 

 

b0

 

0.0

 

n/a

 

The value of parameter b0

 

 

 

 

 

a0

 

0.0

 

n/a

 

The value of parameter a0

 

 

 

 

 

r1

 

0.0

 

n/a

 

The value of parameter r1

 

 

 

 

 

g1

 

0.0

 

n/a

 

The value of parameter g1

 

 

 

 

 

b1

 

0.0

 

n/a

 

The value of parameter b1

 

 

 

 

 

a1

 

0.0

 

n/a

 

The value of parameter a1

 

 

 

 

 

r2

 

0.0

 

n/a

 

The value of parameter r2

 

 

 

 

 

g2

 

0.0

 

n/a

 

The value of parameter g2

 

 

 

 

 

b2

 

0.0

 

n/a

 

The value of parameter b2

 

 

 

 

 

a2

 

0.0

 

n/a

 

The value of parameter a2

 

 

 

 

 

r3

 

0.0

 

n/a

 

The value of parameter r3

 

 

 

 

 

g3

 

0.0

 

n/a

 

The value of parameter g3

 

 

 

 

 

b3

 

0.0

 

n/a

 

The value of parameter b3

 

 

 

 

 

a3

 

0.0

 

n/a

 

The value of parameter a3

 

 

 

 

 

TranslateX

 

0.0

 

n/a

 

The amount the mask should be translated in the x-axis

 

 

 

 

 

TranslateY

 

0.0

 

n/a

 

The amount the mask should be translated in the y-axis

 

 

 

 

 

TranslateZ

 

0.0

 

n/a

 

The amount the mask should be translated in the z-axis

 

 

 

 

 

ScaleX

 

0.0

 

n/a

 

The amount the mask should be scaled in the x-axis

 

 

 

 

 

ScaleY

 

0.0

 

n/a

 

The amount the mask should be scaled in the y-axis

 

 

 

 

 

ScaleZ

 

0.0

 

n/a

 

The amount the mask should be scaled in the z-axis

 

 

 

 

 

RotateAxisX

 

0.0

 

{0.0,1.0}

 

This flag set the rotation (if any) along the x-axis

 

 

 

 

 

RotateAxisY

 

0.0

 

{0.0,1.0}

 

This flag set the rotation (if any) along the y-axis

 

 

 

 

 

RotateAxisZ

 

0.0

 

{0.0,1.0}

 

This flag set the rotation (if any) along the z-axis

 

 

 

 

 

RotateAngle

 

0.0

 

n/a

 

The angle in degrees by which we want to rotate

 

 

 

 

 

CropMedia

 

1

 

{0,1}

 

  • 0 means we will stretch the image so that it fits the screen. It will slightly distort the image where picture aspect ratio and screen aspect ratio differ.

  • 1 means we crop the image to fit the screen. The image will not be distorted but the be appropriately cropped at the edges.

 

 

 

 

 

FlipMode

 

0

 

{0,1,2,3,4}

 

  • 0 FlipMode_None - display the mask in its original orientation

  • 1 FlipMode_Horizontal - Flip the mask orientation horizontally

  • 2 FlipMode_Vertical - Flip the mask orientation vertically

  • 3 FlipMode_HorizontalAndVertical - Flip the mask both horizontally and vertically.

  • 4 FlipMode_Random - Randomly flip the mask

 

 

 

 

 

Quality

 

2

 

{0, 1, 2, 3}

 

  • 0: Quality_Lowest

  • 1: Quality_Lower

  • 2: Quality_Normal

  • 3: Quality_Higher

 

 

 

 

 

GlobalMode

 

0

 

[0,1]

 

  • 0: This means that the effect is a segment-level effect. What that implies is the effect is an Image-Op.

  • 1: This means that the greyscale effect is a global-level effect

Input pattern: (A)
Image-Op: Depends on parameter settings

9.21.2 Examples
9.21.2.1 Mask example
; muSE v2
; 
;  My awesome style.
;  This style demonstrates the mask effect.
 
(style-parameters)
 
(segment-durations 8.0)
 
(define muvee-global-effect
  (effect-stack (effect "Perspective" (A))
                (effect "CropMedia" (A))))

  (define shader-program

"!!ARBfp1.0

TEMP texfrag, mask;

TEX texfrag, fragment.texcoord[0], texture[0], 2D;

TEX mask, fragment.texcoord[1], texture[1], 2D;

TEMP inter;

MUL inter, mask, texfrag;

MOV result.color, inter;

END"

  )

(define muvee-segment-effect
  (effect "Mask" (A)
          (param "Path" (resource "Maskmuvee.jpg"))
          (param "ProgramString" shader-program)
          (param "TranslateX" -0.35 (linear 1.0 0.35))))

The Mask effect loads up and image, and the fragment program multiplies the two images together. Additionally the effect translates the mask along the x-axis from -0.35 to 0.35. The Mask effect is a rather powerful effect. Another effect that was written based on the Mask effect is the GradientFade_ColorBorder effect.

This is a screenshot of the output:

The image below is the mask that was used.