It's this eight term sinusoidal/exponential polar-coodinate function that shows some funky shapes that come out of the harmonics. Then I slapped some circular guides and zipping lines around it to make it, you know, all high tech and stuff. It works pretty well, except with some shapes, it's rendering back faces instead of front faces, because sometimes the function spits out faces that are inside out, and I can't figure out where I have to flip a sign to fix it... It works ok if I render both front and back faces (but that's half as fast) but even then, the twisted faces are too dark, because the normal is pointing the wrong way. This would be a lot easier if I didn't suck at math.
In crisis-narrowly-averted news, I was without DirecTV for most of the day today. After the tech support guy read me the FAQ from their website, and recommended against crawling around on the roof, I went up there to see if someone had sat on my dish or something. It looked fine, but I jiggled it, and now it works again. Percussive maintenance to the rescue again: when in doubt, whack it.
The Spider-Man movie was awesome, I totally loved it. I even approved of the changes they made, like the organic web shooters, and making everyone younger. I had an ancient memory come shooting back while watching it: when Peter was standing over Uncle Ben, I suddenly remembered the first comic book I'd ever owned! I must have been 4 or 5. My mom had been in a fire, and was in the hospital with a tube down her throat, and we were doing a lot of waiting around. My uncle took me to news-stand in the lobby and bought me a Spider-Man comic! I think Mysterio was the villian, but I don't really remember. But anyway, that scene in the movie was extra creepy as a result: Peter's standing there over his uncle's body, and I'm suddenly vividly remembering being a little kid and reading about Spider-Man for the first time on the same day that it dawns on me that people aren't indestructible.
I can't find the comic. How can this be? I never throw anything away! This is horrible.
Where do you get the mathematical formulae from which you build your screensavers? I've always been curious to know.
Sometimes I'll have an idea and then try to figure out how to reproduce it, and sometimes I'll just be messing around and seeing how things look, then tweaking them into a direction I like. For example, with "Goop", I was trying to make something that looked like this mousepad I have, that has a couple of layers of plastic with colored oil between them. So I started experimenting, trying to figure out how to make a good looking "blob" shape. I ended up using radial lines of randomly-changing lengths coming out from a center point, and using the ends of the lines as control points for a curve. But, while I was doing this, I thought "I'll bet this would look neat if the line lengths were symmetrical", and I tried that, and that resulted in the "Starfish" screensaver. Those two don't look anything alike, but they're mostly the same inside. Deluxe is based on some of the visuals they used in a Lush video for the song of the same name. I saw the video and thought, "hey, I could do that." I think Dangerball and Cubenetic both just popped into my head fully formed one day; both of those were more about the motion than the shape, though, so there was a lot of trial and error until it felt right. Then for Cubenetic, I thought of trying to generate an ever-changing texture, and I just cut-and-pasted the guts of the Interference screensaver and used that to generate the object surfaces, so it's really one screensaver embedded in another. But for this latest one, Spheremonics, I was just clicking around, and somehow ended up on Paul Bourke's pages, and he kindly provides the algorithms and occasional sample code for most of the images he generated. So it wasn't too much work to get from there to a screen saver: the hard part is picking good values to feed into the equations, and changing them over time.
Hmm, I've seen oil modled before. usually using metaballs, wich are essentially points with addative or subtracive field strength that diminishes as distance increases from the point. and solid areas are where the collective field strength exceeds some threshold. anything above that threshold is solid, anything below is vaccuum. add random movement and maybe some weak inter-point gravity, and you've got the oil pad. plus, you can do things like dim the edges slightly by making areas that are barely above the threshold be darker, this adding to the oil-like appearance.
I made a little image to demonstrate what I'm talking about. I split the threshold into 2 steps for the sake of illustration instead of just one.
there are a couple ways you could do this. one of them is to simply draw addative radial gradients at each field point onto an off-screen buffer, then for writing to the screen you do:
screen[x][y] = ( (buffer[x][y] > 200) ? 255 : 0);
or to get fancy with a little anti-aliiasing and gradiated edges,
if( buffer[x][y] < 200)
screen[x][y] = 0;
if( buffer[x][y] > 220) // anything over 220 = solid
screen[x][y] = 255;
else // anything 200-220 becomes a gradient from 232 to 255
screen[x][y] = (buffer[x][y] * 1.15909);
/* or to grade from 0 to 255 in that edge range, use
* ((buffer[x][y] - 200) * 12.75)
but another neat trick with radial gradients, is to draw randomly placed, randomly colored radial gradients using a "difference" drawing technique. i.e. the new value is the difference between the on-screen value, and the value of the gradient at that point. essentially a subtractive draw, but you take the absolue value, instead of making negative numbers = 0.
Yeah, I just learned about meatballs recently, they're cool. Haven't done anything with them yet. I see how to generate images like that in 2d (basically by iterating each pixel) but I'm still unclear on how people use these to generate 3d shapes: I can see how to do it in a ray-tracing context (and you'd get fog/blurry perimiters for free), but if you want to generate polygons, you need to somehow iterate the surfaces of these funky concave objects, and I'm missing that part. Knowing how to do that would bring us close to a lavalite screensaver!
I know POV-RAY has support for metaballs, and the source for that is freely available.
the method I outlined is a cheat, which is not what POV anf other packages do. they all create a big old equasion that generates a true solid model.
I can't think of any clever way to cheat them in 3-d. you have to solve the whole thing at once,
you really can't solve each field-point on it's own.
I've found some pages that refers to polygonalizing and metaballs. some may be useful, some may not. I dunno how good your trig is, so some of this may provide AHA! insights.
metaballs are also often called "implicit surfaces", and are technically a volume rendering problem. I've seen references to the "marching cubes" algorithm for solving implicit surfaces( http://portal.acm.org/citation.cfm?id=37422&coll=portal&dl=ACM&CFID=2500613&CFTOKEN=63173030 ).
This one in particular might be useful.
This one has a bibliography that points to a number of articles on this very subject. good luck tracking them down though.
I dunno if this code will be useful, but it is for a raytracer that supports metaballs.
BUT, I think I've got the answer here, I haven't looked at the code in too much detail as it's Delphi, but this describes both the full metaball formula, and how to polygonalize them.
whoops, forgot that last link
So where's the spiff spinning DNA logo screensaver?
It's running on the kiosks! It looks unsurprisingly like my user pic. The cool thing about is that I modeled it with math: I didn't use modeling software because I don't have any. That's all cosine and trial-and-error numeric constants.
Heh. Good to know that I'm not the only one with either the complete disdain for GUI environments for 3D modeling, or the OCD-level of need for perfect detail, that comes with modeling things by hand with math. Laying around somewhere in storage I have a printout of a program I wrote back in junior high that had all of the conic section functions to create a Batman logo.
Oh, and for those of us without access to the kiosks, is there any chance the screensaver will make it up on the DNA site?
Really it's just a matter of: all the modeling software that I've seen for Linux has been either useless, or so complicated it would take me a year to learn how to do even the simplest things. I wish I had a decent modeler, but I guess I don't wish that badly enough to try and learn a program that at first glance appears to be 10x more incomprehensible than Illustrator.
I didn't bother including the DNA saver with xscreensaver because it seemed like it would be of, uh, relatively limited interest.
random semi-connected thought:
my first comic book was an issue of iron man in which he was fighting two other people with iron man-type armor, who were eventually blown into "oblivion", which was represented as an actual place.
next comic i bought was the issue of x-men where wolverine is strapped to the giant X on the cover and he envisions the rest of the team going through the seige perilous.
i want to start buying comics again.