Become a fan of Slashdot on Facebook


Forgot your password?
Graphics Math Science

Using Prime Numbers to Generate Backgrounds 180

bpeh123 pointed out an article about generating organically tiled backgrounds inspired by the life cycle of cicadas. The trick is to overlay multiple background tiles with prime widths thus generating a series that does not repeat for a sufficiently long period. This introduces a seeming irregularity and makes the background appear much more natural.
This discussion has been archived. No new comments can be posted.

Using Prime Numbers to Generate Backgrounds

Comments Filter:
  • by multipartmixed ( 163409 ) on Thursday April 07, 2011 @02:28PM (#35748534) Homepage

    ...NEEEEEEieieiirrrnngngne eEEEEEEEEEEee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeernrng!

  • Other applications. (Score:5, Interesting)

    by Toze ( 1668155 ) on Thursday April 07, 2011 @02:40PM (#35748726)
    Cool. I've looking at automatically generating stuff for games recently. Obviously, this works for authentic-looking backgrounds, but my friends and I were working on a project that involved automating critter generation using classic predator-prey models. One big worry was the farming-to-death of critters that are part of an ecosystem. This idea might be useful for much more nicely randomized or randomized-seeming mob population/spawning.
  • by erroneus ( 253617 ) on Thursday April 07, 2011 @03:03PM (#35749058) Homepage

    Not only did I learn interesting information about the insects I hate the most (and believe me, if I could, I would destroy every last one of the annoying bugs!) but I also learned that you can have multiple images for backgrounds in CSS and have them lay atop one another. (None of the books or software ever seemed to suggest that it was even possible!)

    While the idea is pretty ingenious, if I had known you could specify more than one image for backgrounds, I would have figured this one out on my own -- I have been overlaying images and background images inside of DIVs for a while to get some really nice effects. But now, to be able to lay one atop the another in the same block? AWESOME.

    And yes, at the article says, inferior browsers cannot handle this -- I tried it on IE8 to see what would happen and... yeah... it hung.

  • Re:TL;DR (Score:5, Interesting)

    by sootman ( 158191 ) on Thursday April 07, 2011 @03:55PM (#35749696) Homepage Journal

    How about: Designer comes up with interesting, relevant use of math that all the Math geeks who have been running the WWW for 20 years didn't think of on their own.

    Subtitle: Bitter math nazis harp on his confusion about 1 being a prime.

  • by Sloppy ( 14984 ) on Thursday April 07, 2011 @07:15PM (#35751622) Homepage Journal

    It's not *that* revolutionary. A few months ago, I used the same general principle..

    Well, that's the thing. The general principle is ancient. Using parametrics where each output maps to its own relatively prime cycle to get a very long period .. shit, I was doing that 27 years ago on my Vic20 to make some pretty graphs. (Really.) x=cos(t/7); y=sin(t/13); Graph it, varying "t"; it's purty. And it's pretty damn unlikely that I was the first person to discover (not invent) it; anyone fucking around is eventually going to stumble onto this kind of stuff.

    But this is about background images (and not just background images, but background images on web pages), and I sure as hell wasn't doing that on my Vic20.

    This reminds me the basic difficulty with patents. The ideas themselves often really aren't new, so they're not only obvious in hindsight, but they're even obvious to everyone without hindsight if you ever find yourself working on a problem in a certain area, but if you never end up working on the problems, you're never going to use the idea, so a guy really can be first to do something so basic, in 2011. (Whether this guy actually is, I don't know.) Sure, if you were ever assigned the problem of generating an image with a long period, you might invent this. But did you? (Have you ever needed to generate a background image with a long period? If so, then very likely might have done this. If not, then you just wouldn't ever come up with it.)

    And then some poor schmuck of a patent examiner is supposed to make a judgement call that people in general think is fair. No chance; he's doomed to fail, no matter which way he goes.

    All that aside, it's a cool idea and props to the guy. Just don't fucking patent it, ok? ;-)

    I'm also curious to see just how useful this specific technique is for things other than website backgrounds. For example, you couldn't use it (at least without modification) for most 3D object textures, because it only introduces variation along one axis.

    Heh heh.. don't worry, you'll have the any-dimensional case figured out in a few minutes, if you haven't already. :-)

Love may laugh at locksmiths, but he has a profound respect for money bags. -- Sidney Paternoster, "The Folly of the Wise"