Old 16th February 2002, 05:03   #1
Krash
Major Dude
 
Krash's Avatar
 
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
Sharing my knowledge

When I asked Ryan how to duplicate the zoom effect of milkdrop using dx and dy, this is what he sent me:

Here's the code to implement a manual zoom in the same way that milkdrop
does it:
my_zoom_exp = 1;
my_zoom = 1.02;
a = pow(my_zoom, pow(my_zoom_exp, rad*2-1));
dx = (x - .5)*a + .5 - x;
dy = (y - .5)*a + .5 - y;

Not a secret at all, just a bit convoluted... =)

cheers,
ryan


Now go forth, and use this knowledge for good, and not evil.

- Krash

Eighty-three percent of all statistical quotes are made up on the spot.
Krash is offline   Reply With Quote
Old 16th February 2002, 06:41   #2
unchained
Major Dude
 
Join Date: Jul 2001
Location: richmond, va
Posts: 639
Send a message via Yahoo to unchained
Awesome Krash. Now the obvious question becomes, is there any way to turn off the zoom per-pixel routine completely? By setting it to exactly zero perhaps? That'd be a hell of a speed optimization for presets that use no zoom, or prefer their own method.
unchained is offline   Reply With Quote
Old 16th February 2002, 14:03   #3
Rovastar
Moderator
 
Join Date: Jun 2001
Location: London, England
Posts: 3,632
Send a message via AIM to Rovastar
I see what you mean unchained
Like:

IF zoom <> 1
THEN
my_zoom_exp = 1;
my_zoom = 1.02;
a = pow(my_zoom, pow(my_zoom_exp, rad*2-1));
dx = (x - .5)*a + .5 - x;
dy = (y - .5)*a + .5 - y;
ENDIF


But would it really save that much time?
But if it did we could surely do it for the other effects too. ROt from example.

"Rules are for the guidance of wisemen and the obedience of fools"

Visuals - Morphyre www.Morphyre.com
Rovastar is offline   Reply With Quote
Old 16th February 2002, 15:32   #4
unchained
Major Dude
 
Join Date: Jul 2001
Location: richmond, va
Posts: 639
Send a message via Yahoo to unchained
right. ideally, Ryan's calculations, if they all fall back to simple transformations of dx/dy in this manner, really shouldn't have any "elevated" status in the code, and I wonder what extra optimization they're receiving, if it's only the luxury of passing calls directly to the math lib over somehow pre-processing them. Ideally, I'd like to make some sort of "macros" possible that would only be invoked in the per-pixel code on an as-needed basis, and/or the type of simple flow control you illustrated so well just now.
unchained is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Presets

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump