Monte Carlo stars

The first time I ever implemented a Monte Carlo method was at the very start of my career in computer graphics. The company I was working for, MAGI, needed a star field for a TV commercial.

So I generated lots and lots of points inside a cube, using a random number generator to produce (x,y,z) coordinates. Then I discarded all of the points that were outside of a sphere that fit snugly inside the cube.

I then pushed all of the remaining points out to the surface of the sphere. Voila, stars.

But then the head of CGI told me that he needed more stars in the sky. So I just made lots of copies of my star field.

Everywhere I had put a star, I placed a copy of the entire star field in miniature, centered on that location. By making those clusters bigger or smaller, I could tune how “clumpy” the star field looked.

Then he was happy. The spot aired on TV with my beautiful star field. And then I was happy.

Leave a Reply

Your email address will not be published. Required fields are marked *