Skip to main content
gamedev.net
🔒 Locked

Rendering PI

Started by capn_midnight 24 replies 2.4k views
Original Post
capn_midnight
capn_midnight
I used the BBP algorithm for pi digit extraction, which is handy because it returns hex numbers, which translate into pixel values fairly easily. I started the program around 1am, and this is where I got at around 10am. The progress indicator is hosed, I forgot to blank it out before drawing the next reminder. I have some ideas to speed it up a little bit, as well as some ideas to slow it down, but make it more colorful. I thought about 'chopping the picture to make it look like it just barely drew out a picture of pie, and then replacing it with the original in an hour, but no. I was going for 1024x768, but by the point where it's at it's only calculating less than 1 digit per second.
jbadams
jbadams
Dear god, you have far to much time on your hands man! [lol]

On the other hand, that is strangely cool. *respect*
- Jason Astle-Adams
capn_midnight
capn_midnight
hehe, it was a challenge between me and JM in #gamedev last night. I think I went way to far, though, because we were only supposed to do to a million digits of pi.

I was suprised at how easy the BBP algorithm was to understand. In its basic form, it's useless for digit extraction, but a little algebra here and there gets you the digit extraction.

edit: I was wrong.
just now I thought of a way to modify it for constant-time digit calculation, instead of linear time.
Seriema
Seriema
Oddness! =D
[ ThumbView: Adds thumbnail support for DDS, PCX, TGA and 16 other imagetypes for Windows XP Explorer. ] [ Chocolate peanuts: Brazilian recipe for home made c
dorix
dorix
I spent about a whole minute waiting for that image to "finish loading", and then I read the actual post and felt stupid.
capn_midnight
capn_midnight
well, my avatar is now a 50x50 pixel image that uses 3 hex digits of pi per pixel, so a total of 7500 digits of pi in just that image. The previous image only uses one hex digit per pixel, which is why it is only blue.
Toni Petrina
Toni Petrina
Isn't this idea from Carl Sagan's book "Contact"...
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".
Daaark
Daaark
Quote:
Original post by capn_midnight
well, my avatar is now a 50x50 pixel image that uses 3 hex digits of pi per pixel, so a total of 7500 digits of pi in just that image. The previous image only uses one hex digit per pixel, which is why it is only blue.
Not for those of us with a cache.. *reloads* ah.. looks like some of my first mode 12 basic programs. :)
Ravuya
Ravuya
There's a face in the middle.
Benjamin Heath
Benjamin Heath
Quote:
Original post by Ravuya
There's a face in the middle.
Now that you said it, yeah.
Conner McCloud
Conner McCloud
Quote:
Original post by ffx
Isn't this idea from Carl Sagan's book "Contact"...

Not really. In Contact, they just analyzed pi's digits in various bases for patterns. They weren't specifically rendering images, although they ended up with one. In base 11, I think, the digits drew a perfect circle.

CM
Toni Petrina
Toni Petrina
Quote:
Original post by Conner McCloud
Quote:
Original post by ffx
Isn't this idea from Carl Sagan's book "Contact"...

Not really. In Contact, they just analyzed pi's digits in various bases for patterns. They weren't specifically rendering images, although they ended up with one. In base 11, I think, the digits drew a perfect circle.

CM


Yeah, that's it. Sort of perfection inside a perfect number.
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".
Toni Petrina
Toni Petrina
Quote:
Original post by Vampyre_Dark
OMG!


Capn_midnight is alien from mars and is trying to take over the world

Ruuuuuuuuuuuuuun!
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".
Conner McCloud
Conner McCloud
You should do a nice high resolution one in color, then print it out and tell people you don't like that it's a magic eye image.

CM
capn_midnight
capn_midnight
The problem is, the image is completely determined by how many digits per pixel you use, and how many pixels wide you set the image.

On a related note, I'm thinking of doing this project in our G5 lab. We have 8 Mac G5's, each with dual 2GHz core, dual processor setups.
Conner McCloud
Conner McCloud
Quote:
Original post by capn_midnight
The problem is, the image is completely determined by how many digits per pixel you use, and how many pixels wide you set the image.

On a related note, I'm thinking of doing this project in our G5 lab. We have 8 Mac G5's, each with dual 2GHz core, dual processor setups.

The beauty of my suggestion is that it doesn't matter. You're just trying to trick somebody into staring at a picture of noise for a few hours. Any random width and color depth will suffice.

CM
Daaark
Daaark
Quote:
Original post by capn_midnight
On a related note, I'm thinking of doing this project in our G5 lab. We have 8 Mac G5's, each with dual 2GHz core, dual processor setups.


[lol]








Nice Coder
Nice Coder
You can download a couple of gigs of pi from a few sites. (google around and you'll find it. Its like (firstdigitsofpi).com (replace the stuff in the brackets with the actual digits).

From that, it should be pretty simple just to parse it and load it onto one massive image. (two prime numbered sizes to make it nice).

You then send it out into space, to see if et has learned pi yet. (or you use it for obnoxious visitors).

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.