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} |
|
|
|
|
|
| ||||
| FlipMode |
| 0 |
| {0,1,2,3,4} |
|
|
|
|
|
| ||||
| Quality |
| 2 |
| {0, 1, 2, 3} |
|
|
|
|
|
| ||||
| GlobalMode |
| 0 |
| [0,1] |
|
|
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))))
"!!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.