View Single Post
Old 5th October 2015, 16:42   #2
Nitorami
Major Dude
 
Join Date: Mar 2008
Location: Erlangen
Posts: 807
Send a message via ICQ to Nitorami
Hi LambdaFox

I am not an expert in image handling but can tell you how I would do it. Sample file attached.
Note 1: Do nothing of what I'll describe with the sample preset where I've done it already !

Note 2: You need to activate ScrollLock first to prevent milkdrop from changing the preset while you are working on it ! If there is no scroll lock on your keyboard... good luck! You may go to the milkdrop visualisation menu, configuration, and tick the box "start milkdrop with scroll lock on", or set the time between preset changes to 9999 and deactivate hard cuts (triggered by strong beats). That should do the trick.

1. Run the preset and press M to bring up the menu.
2. Rovastar presets are quite old and you need to update the shader version first. Do this by menu. Once you have confirmed the warning, you'll see two new menu entries, "edit warp shader" and "edit composite shader".
3. Open Edit Comp Shader.
4. In the first line, insert
code:
sampler sampler_xxx;

where xxx stands for the desired image filename without extension. The image must be in your preset or (preferred) \textures folder. This just tells the preset to load the image but not to show it yet.

5. After the last line, insert
code:
ret += tex2D (sampler_xxx,uv);


Press Ctrl-Enter to accept changes. The changes take effect immediately unless you made a mistake.

Explanation: In the comp shader, "ret" is the output variable which goes drectly to the screen. Very simple. We take the existing ret (by Rovastar) and add the image content by a call to the texture sampler tex2D. You may wish to manipulate ret before you do that, it is quite straightforward. For instance ret *= 0.5; will darken the content by 50%; you can likewise do this with your image. You can do all sorts of mathematical operations and do not need to bother with individual screen pixels. As by magic, the operation applies to the whole screen content. It is fun.

6. Leave the menu and press S to save preset.

The sample preset will show a random texture found in the folder. All you need to do is to replace rand00 by a proper filename.

Oh, and the image will be stretched to the screen. If you need it scaled or displayed in original pixel resolution, this can be done easily but I need to look up how.

Martin
Nitorami is offline   Reply With Quote