|
| 1 | +--- |
| 2 | +title: Rendering Process |
| 3 | +description: All built-in effects and their rendering order. |
| 4 | +--- |
| 5 | + |
| 6 | +## Preset Versions |
| 7 | + |
| 8 | +Before listing all effects, it's important to know the differences between preset versions. |
| 9 | + |
| 10 | +In general, presets are different between Milkdrop 1.x and Milkdrop 2.x. This is because Milkdrop 1 did not support |
| 11 | +using pixel shaders, they only supported a fixed set of effects which could be controlled using certain predefined |
| 12 | +parameters. |
| 13 | + |
| 14 | +Milkdrop 2.0 introduced shader support and since Milkdrop 2.0.1, preset authors could choose to use different shader |
| 15 | +versions for both warp and composite shaders (or disable them individually). |
| 16 | + |
| 17 | +As a rule of thumb, all Milkdrop 1 post-processing effects listed below will be disabled if a user-defined composite |
| 18 | +shader is enabled. |
| 19 | + |
| 20 | +## Preset Loading |
| 21 | + |
| 22 | +When loading a preset, all `init` expression code blocks will be executed _once_, in this order: |
| 23 | + |
| 24 | +- `per_frame_init` |
| 25 | +- `wave_0_init` |
| 26 | +- `wave_1_init` |
| 27 | +- `wave_2_init` |
| 28 | +- `wave_3_init` |
| 29 | +- `shape_0_init` |
| 30 | +- `shape_1_init` |
| 31 | +- `shape_2_init` |
| 32 | +- `shape_3_init` |
| 33 | + |
| 34 | +## Rendering Order |
| 35 | + |
| 36 | +The following sections lists all Milkdrop built-in effects in the order they're being rendered. The rendering order is |
| 37 | +important to achieve certain effects. |
| 38 | + |
| 39 | +Each effect is described in more detail in the [following chapter](effects). |
| 40 | + |
| 41 | +### Frame Setup |
| 42 | + |
| 43 | +This step doesn't render anything, but executes the `per_frame_` code block. |
| 44 | + |
| 45 | +### Motion Vector Grid |
| 46 | + |
| 47 | +Draws a grid of colored dots or lines on top of the previous frame's image. The lines represent the apparent motion ( |
| 48 | +speed and direction) of the warp effect. |
| 49 | + |
| 50 | +Not that this is the only effect which is drawn _before_ warping the image. |
| 51 | + |
| 52 | +### Image Warp |
| 53 | + |
| 54 | +A full-screen effect which allows to transform the previous frame's image in many different ways. This effect consists |
| 55 | +of multiple steps: |
| 56 | + |
| 57 | +1. For each intersection in the user-defined warp mesh grid, the "per-vertex" or "per-pixel" expression code is |
| 58 | + executed. |
| 59 | +2. If the preset version is less than `200` or the warp pixel shader version less than `2`, a simple default warp shader |
| 60 | + will be used. This shader also applies the `decay` value by multiplying the resulting color with the set value. |
| 61 | +3. Otherwise, the warp shader contained in the preset will be executed and rendered. It may or may not use the warp grid |
| 62 | + U/V coordinates. The `decay` value will not be applied automatically. |
| 63 | + |
| 64 | +### Custom Shapes |
| 65 | + |
| 66 | +A preset may use up to 4 sets of custom shapes, each with 1 to 1024 instances. Shapes 1 to 4 are rendered in order and |
| 67 | +thus on top of each other. |
| 68 | + |
| 69 | +Each shape instance can have a colored or textured interior, and also an optional colored border around it. |
| 70 | + |
| 71 | +### Custom Waveforms |
| 72 | + |
| 73 | +Custom waveforms, of which up to 4 can be used, render lines or dots and can use audio or spectrum data to animate the |
| 74 | +waveform. |
| 75 | + |
| 76 | +The coordinates and color of each individual point which makes up the waveform can be scripted using expression code. |
| 77 | +This allows to draw arbitrary shapes. |
| 78 | + |
| 79 | +### Default Waveform |
| 80 | + |
| 81 | +A single waveform with eight predefined drawing modes. The mode, color, position and scaling of the waveform can be |
| 82 | +customized. |
| 83 | + |
| 84 | +### Darken Center |
| 85 | + |
| 86 | +A simple effect which draws a diamond-shaped area in the center of the screen which darkens pixels more the closer they |
| 87 | +are to the center. |
| 88 | + |
| 89 | +### Image Borders |
| 90 | + |
| 91 | +Two configurable borders around the whole screen, one inner and one outer border. Each can have individual color and |
| 92 | +width. |
| 93 | + |
| 94 | +### Post-Processing / Composite Effect(s) |
| 95 | + |
| 96 | +Before any post-processing effects are applied, the current preset image is stored and passed on to the next frame. This |
| 97 | +means any of the effects described in this section are only display to the viewer and the image will then be discarded. |
| 98 | + |
| 99 | +If the preset version is at least `200` (Milkdrop 2.0) and a pixel shader version >= 2 is set for the composite shader, |
| 100 | +only the "Composite Shader" effect is drawn and the other effects below are skipped. |
| 101 | + |
| 102 | +If no composite shader is enabled as stated above, the five "classic" post-processing filters are drawn if enabled |
| 103 | +individually. |
| 104 | + |
| 105 | +#### Composite Shader |
| 106 | + |
| 107 | +The composite shader can contain arbitrary HLSL code. |
| 108 | + |
| 109 | +If the preset contains composite shader code, the shader is executed to draw the final image. none of the following |
| 110 | +effects will be applied in this case. |
| 111 | + |
| 112 | +#### Video Echo |
| 113 | + |
| 114 | +Renders a copy of the current preset image ofer the existing one. The image can be flipped on the X and Y axis and |
| 115 | +zoomed in or out. The opacity of the effect can also be specified from 0% (effect disabled) to 100% (only rendering the |
| 116 | +echo). |
| 117 | + |
| 118 | +#### Brighten Image |
| 119 | + |
| 120 | +Brightens the whole image using a square filter. |
| 121 | + |
| 122 | +#### Darken Image |
| 123 | + |
| 124 | +Darkens the whole image using a square filter. |
| 125 | + |
| 126 | +#### Solarize |
| 127 | + |
| 128 | +Emphasizes medium-bright colors of the image. |
| 129 | + |
| 130 | +#### Gamma Adjustment |
| 131 | + |
| 132 | +Applies a gamma filter, eventually multiple times, to adjust the overall image brightness. |
0 commit comments