Mark Sachs (ksleet) wrote,
Mark Sachs

  • Mood:
  • Music:

Get down as if today was the annual celebration of the day you were born.

Nothing too flashy today raytracer-wise -- in fact, I ran into some weird frustration which I'll detail -- but I might as well upload the images.

At first I wasn't too sure what I wanted to do, so just to establish the principle that yes, this is a raytracer, I implemented a reflective sphere. When the ray from the camera strikes this object, we just send the ray on its way in another direction to see what it runs into, use that for the pixel color, and Robert is the brother of your father, it's a mirror. The same technique would turn the sphere into a lens instead -- just compute a different direction for the ray. As a matter of fact, all those links about simulating the distortion of light near a black hole made me think that would be a wicked-cool thing to have in this raytracer as well, although I suspect the math for that is a leetle bit more complex.

After that I thought about it a bit and realized that the way I was doing the Jovian planet and the rings isn't really in the spirit of this thing. Their appearance is largely hardcoded -- 100%, in the case of the rings, and for the gas giant I was randomly constructing ten gas rings of different colors and placing them around the planet. It would be far better to create a one-dimensional fractal class which I could use for things like this which need to vary along a single axis. So I did. The results don't actually look too different -- other than making it even clearer there needs to be some way to anti-alias these images -- but the underlying system which built them is a lot more flexible.

I suppose that one thing I'd like to do with this project is come up with some general rules for planet formation that can create planets such as those in our Solar System based on certain input values -- the type of star, its age, the mass and elemental composition of the planets, and so forth. Then, vary the input values to create a wide variety of different but physically plausible solar systems.

However, today I ran into something rather deranged. The raytracer was running hugely more slowly when drawing the gas giant than when drawing the terrestrial world, which was just odd -- the terrestrial world is far more complex, after all. I started pulling things out of the code left and right and discovered that when I add a particular member variable to the gas giant world class, it suddenly runs as fast as the terrestrial. And when I remove it, it runs incredibly slowly. This member variable is never even referred to except during construction. This makes absolutely no sense to me. None!

Also, it's my birthday today.
Tags: personal, raytracer
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.