|
|
#1 |
|
Major Dude
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
|
Witness the power of milkdrop...
WARNING: This is NOT a conventional preset. In fact, as I am about to give to you, it's an extremely boring preset, and consists of a white circle in one corner. The beauty of this preset is the mathematics, and how customisable it is. So unless you want to get your hands dirty in editing presets, steer clear of this one.
Rightio, now that I've got that sorted. Have you ever wondered just how much you could do with MilkDrop? I don't mean the blending effects that are possible - we've all seen what can be done with those. What I mean, is complex mathematics that is much more than random strings of equations. Well, I endeavoured to find out, and the result is: A semi-realistic, and fully customisable, PHYSICS ENGINE inside milkdrop, which simulates a bouncing ball. At this point, I'm going to explain what each of my variables actually define, and how you go about changing the preset. right_extreme: This variable defines the invisible wall on the right hand side that the ball will bounce off. a value of 0.5 is the middle of the screeen, a value of 1 is the right side of the screen. Higher than 1 is off the screen. left_extreme: The opposite of right_extreme. A value of 0 is the left side of the screen. Less than 0 is off the screen. top_extreme: An invisible ceiling that the ball can bounce off. A value of 1 is the top of the screen, 0.5 is the middle of the screen. bottom_extreme: The invisible floor - 0 is the bottom of the screen. Note that it's the CENTRE of the ball that does the bouncing, so it's best to have the invisible walls somewhat inside the screen, or it looks a bit weird. x_start_speed: What it says - this is the initial horizontal speed of the ball. Positive is to the right, negative is to the left. Small values (around 0.01) are recommended. x_speed_loss: Simulates the loss (or gain) of horizontal velocity whenever the ball bounces. A value of 1 will remove the effect. Values less than 1 will slow the ball down until it eventually stops. Values greater than 1 will gradually speed it up, until it flies off the screen, never to be seen again. Negative values will just do weird stuff. Don't go there. gravity: Exactly what it says. Negative values will work just fine. y_start_speed: This should be obvious. Consider it proportional to the x_start_speed. y_speed_loss: This is a boolean value - yes or no, on or off. A value of 0, and the ball will bounce forever. If you set it to 1, eventually the ball will rest on the ground. The time it takes to stop bouncing is realtive to gravity. initialise: This is the most important value, and the one you'll need to change if you want any of your other changes to work. Note that during the preset, initialise is declared twice. ONLY change the first one. Any time you want to change one of the values, go to the per_frame equations, set initialise to 1, and make your changes, then hit ctrl-enter. You will see the ball move to the bottom right corner. Then change initialise back to 0, and hit ctrl-enter again. The ball will start its merry journey. Change any of the other equations at your own peril, but I will explain what the variables represent, so it's a bit easier to understand. direction: Whether the ball is moving left or right. x_speed: This should be obvious. y_speed: Again, it should be obvious - it's used to allow the parabolic arcs to work properly. wave_x_mod: Used to calculate the x position of the ball, relative to the centre of the screen. wave_y_mod: Used to calculate the y position of the ball, relative to bottom_extreme. bounce: detects whether or not the ball has struck the ground or ceiling, and as such, should reverse its direction. Okay, I think that's everything. Now, it's time for the preset. Have some fun with it. I'd be pretty surprised if anyone bothered to make something pretty out of this, but by all means, give it a shot. ============= Bouncing Ball ============= [preset00] fRating=3.000000 fGammaAdj=2.000000 fDecay=0.980000 fVideoEchoZoom=1.000000 fVideoEchoAlpha=0.000000 nVideoEchoOrientation=0 nWaveMode=0 bAdditiveWaves=0 bWaveDots=0 bModWaveAlphaByVolume=0 bMaximizeWaveColor=0 bTexWrap=0 bDarkenCenter=0 bMotionVectorsOn=0 bRedBlueStereo=0 nMotionVectorsX=12 nMotionVectorsY=9 bBrighten=0 bDarken=0 bSolarize=0 bInvert=0 fWaveAlpha=1.000000 fWaveScale=0.010000 fWaveSmoothing=0.750000 fWaveParam=-0.380000 fModWaveAlphaStart=0.750000 fModWaveAlphaEnd=0.950000 fWarpAnimSpeed=1.000000 fWarpScale=1.000000 fZoomExponent=1.000000 fShader=0.000000 zoom=1.000000 rot=0.000000 cx=0.500000 cy=0.500000 dx=0.000000 dy=0.000000 warp=1.000000 sx=1.000000 sy=1.000000 wave_r=0.500000 wave_g=0.500000 wave_b=0.500000 wave_x=0.500000 wave_y=0.500000 ob_size=0.000000 ob_r=0.000000 ob_g=0.000000 ob_b=0.000000 ob_a=0.000000 ib_size=0.000000 ib_r=0.000000 ib_g=0.000000 ib_b=0.000000 ib_a=0.000000 per_frame_1=warp=0; per_frame_2=dx=-0.0005; per_frame_3=dy=-0.0005; per_frame_4=right_extreme = 0.9; per_frame_5=left_extreme = 0.1; per_frame_6=bottom_extreme = 0.1; per_frame_7=top_extreme = 0.9; per_frame_8=x_start_speed = 0.01; per_frame_9=x_speed_loss = 1; per_frame_10=gravity = 0.002; per_frame_11=y_start_speed = 0.05; per_frame_12=y_speed_loss = 0; per_frame_13=initialise = 1; per_frame_14=direction = if(equal(initialise,1),1,direction); per_frame_15=x_speed = if(equal(initialise,1),x_start_speed,x_speed); per_frame_16=y_speed = if(equal(initialise,1),y_start_speed,y_speed); per_frame_17=wave_x_mod = right_extreme - 0.5; per_frame_18=wave_y_mod = if(equal(initialise,1),0.001,wave_y_mod); per_frame_19=initialise = 0; per_frame_20=direction = if(above(wave_x_mod,(right_extreme - 0.5)),-1,if(below(wave_x_mod,(left_extreme - 0.5)),1,direction)); per_frame_21=bounce = below(wave_y_mod,0) + equal(wave_y_mod,0) + above(wave_y_mod,(top_extreme - bottom_extreme)) + equal(wave_y_mod,(top_extreme - bottom_extreme)); per_frame_22=x_speed = x_speed*if(equal(bounce,0),1,x_speed_loss)*if(above(wave_x_mod,(right_extreme - 0.5)),x_speed_loss,if(below(wave_x_mod,(left_extreme - 0.5)),x_speed_loss,1))*if(equal(y_speed,0),x_speed_loss,1); per_frame_23=wave_x_mod = wave_x_mod + direction*x_speed; per_frame_24=wave_x = wave_x + wave_x_mod; per_frame_25=y_speed = y_speed - if(equal(bounce,0),if(equal(y_speed_loss,1),0,gravity),2*y_speed) - equal(y_speed_loss,1)*gravity; per_frame_26=y_speed = if( above( wave_y_mod, 0 ), if( below( wave_y_mod, 0.001 ), if( below( abs( y_speed ), gravity*1.01 ), 0, y_speed ), y_speed ), if(below(y_speed, 0), -y_speed*0.9, y_speed)); per_frame_27=wave_y_mod = wave_y_mod + y_speed; per_frame_28=wave_y = bottom_extreme + wave_y_mod; Enjoy. - Krash |
|
|
|
|
|
#2 |
|
Major Dude
|
Please see my recent presets for a workaround to handling initialize.
![]() -- unchained |
|
|
|
|
|
#3 |
|
Major Dude
|
What's particularly beautiful about the math? You're doing the same things I'm doing in my three most recently posted presets...I could run down the list and assign names to all of the test conditions, thereby making it a "physics engine".
It takes me HOURS to make some of my presets. If my presets look like a random stings of equations to you, it's probably because they're arrived and quasi-heuristicly, but believe me I'm breaking my ASS to figure out some of the math going on. I can't thank you enough for explaining the polar geometry to me...if you could coble together another preset of the same type as the bounce, but based on wave functions, I would consider it an incredible learning tool, but I can't understand why you wouldn't much rather just make something fun. ![]() -- unchained |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
Huh?
Krash,
Your ideas sound good, but on my machine, bouncing ball is a white circle which doesn't even move at all, even during the most "active" songs which have a really strong beat, so I don't know how it would be used as a basis for other presets. Sorry if I've misunderstood what you mean, but I'd assume bouncing ball would at least move? I had similar problems with disc, vinyl disc, and Zylot's nofrat's disc, all of which basically appeared to do nothing except change colour occassionally, yet some of the variations on them (esp. morat's disc, morat's third eye) looked awesome. Maybe it's because I'm running them in 16-bit colour, but I can't see how the originals were supposed to look "good", IMHO. Could you post a screenshot of what these presets are supposed to look like, because I think I must have something wrong with them... Thanks... |
|
|
|
#5 |
|
Moderator
|
People lets not fall out on these forums.
I beleive that Krash is refering to me (and people worse than me) with his comments on 'random strings of equations' because that is what I do - although I have a good undersatanding of maths not in zylot/ unchained/ krash's level. Or people that get a preset and change 1 value to increase xzoom 10% or something. So don't be upset unchained. I don't care hopefully I create some pretty effective and orginal presets.........But don't get me wrong it can take hours but most of the time it is perfecing the initial random idea I have created. That is way my presets are normally only a couple of lines of per_ code. (I will probably lose a load of respect from the MD community for these admissions......) The biggest problem I have with is preset is a MD problem the is so much code in the per_frame code that is does not fit on the screen when MD is running. But this is for the troubleshooting forum. Dark Illusion there is nothing wrong with your machine. In the presets current state it does nothing but if you change the first initialise value to 0 the ball will bounce up and down. But I have not looked at this preset yet for what this preset can do you, etc. It is designed as a template for us preset writers. Hope that helped, Rovastar |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
|
Unchained:
I'm sorry if I got you uptight about things - I didn't mean to do anything of the sort. I'm sure alot of your presets (the more recent ones in particular) were very well thought out. To be honest - I haven't actually examined your code to see what's going on. So I didn't mean to put you or your presets down in any way, shape, or form. The only thing about this preset that I'm particularly proud of, is how easy it is to customise. The mathematics itself is really nothing special - It's only high school physics. I was just pleased with myself that it was (from a programmer's perspective) designed well - in that variables and constants were clearly defined, and changing a single value at one point would affect the entire preset the way you would expect. That's all, really. You would have noticed in the past that I'm not exactly a prodigious preset producer (how's that for alliteration?). I very rarely sit down to make a preset with any particular goal in mind, as far as visual effects are concerned, anyway. Most of my presets are a case of "I wonder if I could get it to do this?" (bouncing ball, the spiral presets), or "knowing how milkdrop works, I wonder what happens if I do this?" (the disc presets). It's only when I can get something to work, that I actually sit down and turn it into something that's pretty to watch. So, I'm sorry if my attitude previously got you a bit frustrated/angry with me, and I hope that what I've said here won't make it any worse. On another point: Dark Illusion - you can find presets of what vinyl disc and rainbow reflection are supposed to look like at these addresses: http://krash.idx.com.au/secret/vinyl.jpg http://krash.idx.com.au/secret/rainbow.jpg and btw, disc is actually the precursor to vinyl disc, and isn't really in a finished state. I suggest you delete it, and just keep vinyl disc. - Krash |
|
|
|
|
|
#7 |
|
Major Dude
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
|
Eep! I just realised I posted a version of the preset that doesn't actually work properly! Sorry everyone.
Here's a fixed version: ===================== Bouncing Ball (fixed) ===================== [preset00] fRating=3.000000 fGammaAdj=2.000000 fDecay=0.980000 fVideoEchoZoom=1.000000 fVideoEchoAlpha=0.000000 nVideoEchoOrientation=0 nWaveMode=0 bAdditiveWaves=0 bWaveDots=0 bModWaveAlphaByVolume=0 bMaximizeWaveColor=0 bTexWrap=0 bDarkenCenter=0 bMotionVectorsOn=0 bRedBlueStereo=0 nMotionVectorsX=12 nMotionVectorsY=9 bBrighten=0 bDarken=0 bSolarize=0 bInvert=0 fWaveAlpha=1.000000 fWaveScale=0.010000 fWaveSmoothing=0.750000 fWaveParam=-0.380000 fModWaveAlphaStart=0.750000 fModWaveAlphaEnd=0.950000 fWarpAnimSpeed=1.000000 fWarpScale=1.000000 fZoomExponent=1.000000 fShader=0.000000 zoom=1.000000 rot=0.000000 cx=0.500000 cy=0.500000 dx=0.000000 dy=0.000000 warp=1.000000 sx=1.000000 sy=1.000000 wave_r=0.500000 wave_g=0.500000 wave_b=0.500000 wave_x=0.500000 wave_y=0.500000 ob_size=0.000000 ob_r=0.000000 ob_g=0.000000 ob_b=0.000000 ob_a=0.000000 ib_size=0.000000 ib_r=0.000000 ib_g=0.000000 ib_b=0.000000 ib_a=0.000000 per_frame_1=warp=0; per_frame_2=dx=-0.0005; per_frame_3=dy=-0.0005; per_frame_4=right_extreme = 0.9; per_frame_5=left_extreme = 0.1; per_frame_6=bottom_extreme = 0.1; per_frame_7=top_extreme = 0.9; per_frame_8=x_start_speed = 0.01; per_frame_9=x_speed_loss = 0.95; per_frame_10=gravity = 0.002; per_frame_11=y_start_speed = 0.05; per_frame_12=y_speed_loss = 0; per_frame_13=initialise = 0; per_frame_14=direction = if(equal(initialise,1),1,direction); per_frame_15=x_speed = if(equal(initialise,1),x_start_speed,x_speed); per_frame_16=y_speed = if(equal(initialise,1),y_start_speed,y_speed); per_frame_17=wave_x_mod = if(equal(initialise,1),right_extreme - 0.5,wave_x_mod); per_frame_18=wave_y_mod = if(equal(initialise,1),0.001,wave_y_mod); per_frame_19=initialise = 0; per_frame_20=direction = if(above(wave_x_mod,(right_extreme - 0.5)),-1,if(below(wave_x_mod,(left_extreme - 0.5)),1,direction)); per_frame_21=bounce = below(wave_y_mod,0) + equal(wave_y_mod,0) + above(wave_y_mod,(top_extreme - bottom_extreme)) + equal(wave_y_mod,(top_extreme - bottom_extreme)); per_frame_22=x_speed = x_speed*if(equal(bounce,0),1,x_speed_loss)*if(above(wave_x_mod,(right_extreme - 0.5)),x_speed_loss,if(below(wave_x_mod,(left_extreme - 0.5)),x_speed_loss,1))*if(equal(y_speed,0),x_speed_loss,1); per_frame_23=wave_x_mod = wave_x_mod + direction*x_speed; per_frame_24=wave_x = wave_x + wave_x_mod; per_frame_25=y_speed = y_speed - if(equal(bounce,0),if(equal(y_speed_loss,1),0,gravity),2*y_speed) - equal(y_speed_loss,1)*gravity; per_frame_26=y_speed = if( above( wave_y_mod, 0 ), if( below( wave_y_mod, 0.001 ), if( below( abs( y_speed ), gravity*1.01 ), 0, y_speed ), y_speed ), if(below(y_speed, 0), -y_speed*0.9, y_speed)); per_frame_27=wave_y_mod = wave_y_mod + y_speed; per_frame_28=wave_y = bottom_extreme + wave_y_mod; - Krash |
|
|
|
|
|
#8 |
|
Guest
Posts: n/a
|
Also, Krash, I looked at your screenshots, mine look nothing like that, I've attached one of vinyl disc during one of the most beat-driven songs I have, perhaps it's an issue with 16-bit colour (my vid card won't do 32-bit)? Rainbow reflection has a very similar problem.
I posted a couple of presets on the other board, I'd appreciate yours or anyone else's feedback on them, it's much harder than it looks to make presets!
|
|
|
|
#9 |
|
Major Dude
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
|
From the screen shot, it appears that the preset simply isn't rotating as fast as it should. Try copying the preset again, or failing that, I'll upload it.
EDIT: I meant to post this as well: http://krash.idx.com.au/secret/bouncing.jpg EDIT2: Just discovered - it is a result of you running in 16bit mode. You know the 16-bit brightness correction thingy? Move that a couple notches closer to the brighter end, and the disc preset should work. - Krash Last edited by Krash; 20th October 2001 at 16:17. |
|
|
|
|
|
#10 |
|
Major Dude
|
Hey hey now, I ain't too hot with math, I just have the ideas on how it works..
now, for bouncing ball, it doesn't seem to be doing anything. I have been having problems with making variables that don't reset to their original values... which has been a major problem for me. I had some great progressive and other odd ideas that simply could not be done... ------------- What do you wish for? --Instrumentality |
|
|
|
|
|
#11 |
|
Major Dude
|
First of all sorry to sound stand-offish. I have tourette's, and a lot of times I come off that way. Picture me rolling my eyes and sighing a lot when I talk too...I sure do win people over at parties.
![]() At any rate, I had a lot of fun with bouncing ball, (once I fiddled a bit to get it working) and played around with adding my "grid planet thingy" effect to it, making it bounce around. I can't quite get anything exciting (tried changing gravity based on volume and such) enough to post working, but it's given me some ideas. I've considered adding constants and trying to make my presets clearer to the reader, but there just don't seem to be enough active developers around to make it worth the effort. If anybody has any questions about my code, I'm always more than happy to break it down. Assembly was my first language, and I've worked extensively in asm, forth, compiler development, and things like that....as such, I'm used to looking at much larger chunks of code before I even consider giving them a name, and I'm not a big fan of the existance of variables in general Oh sure, I do a bit of code in C and Perl and whatnot, but it's rarely human-readable...too much freedom of expression in high level languages, and if there's a way to re-use a value, or let something fall through the stack, I'll usually find it.So, the point of my rambling is that coding presets is a constant battle for me, between making things human-readable, or using my own internal greek. ![]() Again, sorry for making an ass of myself. Believe me, I'm not going to get upset over something as trivial as Milkdrop, even if somebody directly insults me. It's just not that important in the grand scheme of things. -- unchained |
|
|
|
|
|
#12 |
|
Major Dude
|
Zylot, take a look at my last few new ones, I've got flip/flop variables, accumulators, and so on. If you can't figure it out, or you have a specific piece of code or problem you can't get going, I'd be more than happy to take a look at it.
-- unchained |
|
|
|
|
|
#13 |
|
Major Dude
|
This is purely demonstration code, and shows how I do several effects I've used lately, for anybody interested. I'll go through it line-by-line at the bottom.
============== Simple Times ============== [preset00] fRating=3.000000 fGammaAdj=2.000000 fDecay=0.970000 fVideoEchoZoom=1.006595 fVideoEchoAlpha=0.000000 nVideoEchoOrientation=0 nWaveMode=1 bAdditiveWaves=0 bWaveDots=0 bModWaveAlphaByVolume=0 bMaximizeWaveColor=1 bTexWrap=0 bDarkenCenter=0 bMotionVectorsOn=0 bRedBlueStereo=0 nMotionVectorsX=12 nMotionVectorsY=9 bBrighten=0 bDarken=0 bSolarize=0 bInvert=0 fWaveAlpha=1.704175 fWaveScale=0.972366 fWaveSmoothing=0.000000 fWaveParam=0.000000 fModWaveAlphaStart=0.750000 fModWaveAlphaEnd=0.950000 fWarpAnimSpeed=1.000000 fWarpScale=1.000000 fZoomExponent=1.000000 fShader=1.000000 zoom=1.000000 rot=0.000000 cx=0.500000 cy=0.500000 dx=0.000000 dy=0.000000 warp=1.000000 sx=1.000000 sy=1.000000 wave_r=0.500000 wave_g=0.500000 wave_b=0.500000 wave_x=0.500000 wave_y=0.500000 ob_size=0.010000 ob_r=0.000000 ob_g=0.000000 ob_b=0.000000 ob_a=0.000000 ib_size=0.010000 ib_r=0.250000 ib_g=0.250000 ib_b=0.250000 ib_a=0.000000 per_frame_1=warp = 0; per_frame_2=color_cycle_speed=0.35; per_frame_3=color_shift=if(above(abs(color_shift),10000),-100,color_shift+color_cycle_speed); per_frame_4=wave_r = wave_r + .5*sin(color_shift*.999*color_cycle_speed); per_frame_5=wave_g = wave_g + .5*sin(color_shift*.998*color_cycle_speed); per_frame_6=wave_b = wave_b + .5*sin(color_shift*.997*color_cycle_speed); per_frame_7=pulse_timer=sin(time*10); per_frame_8=wave_mystery=above(abs(pulse_timer),0); per_pixel_1=anti_rad=1-rad; per_pixel_2=grid=x*10%2 + y*10%2; per_pixel_3=throttle=.06; per_pixel_4=breathing_time=sin(time*.8); per_pixel_5=curvature=cos(abs(rad*2-1)); per_pixel_6=full_curve=anti_rad*throttle*curvature*breathing_time; per_pixel_7=curved_grid=equal(equal(grid,0),0)*-full_curve; per_pixel_8=zoom=zoom+curved_grid; Frame stuff: (Things that effect the screen as a whole) warp=0; Most presets set this first, since warp tends to over-ride any other effect, and just give you a big puddle of goo. As a general rule, unless your pointing it at a specific area of the screen (ie. in per-pixel code), don't touch warp. color_cycle_speed, color_shift, etc This is a crude attempt at making a constant valued color change speed. Krash could probably fix up this code a bit, and explain it better. From my point of view, sin() is a magic box that you put a value into, and it changes that value into a "wave" passing between -1 and 1 and back. pulse_timer=sin(time*10); wave_mystery=above(abs(pulse_timer),0); This flips the wave_mystery value back and forth between 1 and 0, relatively quickly. Ryan's preset authoring guide explains how to use sin waves for timing pretty clearly. Pixel stuff: (Effects specific parts of the screen differently) per_pixel_1=anti_rad=1-rad; Here I want the opposite of the radius, so that the effect is more pronounced in the middle of the screen. per_pixel_2=grid=x*10%2 + y*10%2 +1; This chops the screen up into a grid pattern. Taken as 10x10 chunks, if a given x,y pixel falls into an odd chunk, grid will be 1. per_pixel_3=throttle=.06; The breathing effect is actually done by taking small little gasps. If you were to breath in your inhale your entire lung capacity at once, your lung would explode, and that's exactly what happens if you set this too high. (Though it makes pretty pictures sometimes) per_pixel_4=breathing_time=sin(time*.8); This is how long each full breath will take. (In gasps the size of throttle) per_pixel_5=curvature=cos(abs(rad*2-1)); Here's the magic line. This yields a value that goes up as we get farther from the center of the screen, at that magical curve that looks JUST right to give the impression of a sphere. If you use x or y instead of the radius, you can curve the entire screen around either axis, like a piece of paper rolling up. This, or something like it, is used in a lot of the "planet" type presets, often passing the value into a sin wave, to make the screen roll from left to right. per_pixel_6=full_curve=anti_rad*throttle*breathing_time*curvature; Here's the wrap up; the distance from the edge of the screen, with the size of the "gasp" we're taking, how far into that gasp we are, and the ammount our lung is curved at that point. per_pixel_7=curved_grid=equal(equal(grid,1),0)*-full_curve; I phrased this line tricky, just because Krash has started doing funky ifs like this, and they save some screen real-estate. It's saying if we're on the grid, we get the opposite (negative) ammount of curvature. per_pixel_8=zoom=zoom+curved_grid; And add it to the zoom...all done! Oh well...chances are nobody cares, and I think I probably spelled curvature wrong (if not, then surely a great many other things). Questions, Comments, Concerns? Let me know. <snicker> -- unchained |
|
|
|
|
|
#14 |
|
Major Dude
Join Date: Jun 2001
Location: Sydney, Australia
Posts: 977
|
That was a very interesting read - it's good to be able to follow what it is that you're doing, and it's easier to understand than having to decipher it on my own.
Talking about your modifications to bouncing ball - it's nice to hear you've had some ideas - that was the main reason I made it. I was hoping that having constants clearly defined would make it easier to add in responsiveness, etc. and FWIW, you spelled curvature correctly =] - Krash |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|