Mark Sachs (ksleet) wrote,
Mark Sachs

  • Mood:
  • Music:

More graphics.

(And it's time to break out the Santa hat again!)

So now it looks a little more planet-y.

There are two main additions. First, I created a SolarSystem class which organizes a bunch of planets (fine, I'll break down and call them that.) When you trace a ray through the scene, the SolarSystem will find which planet it intersects closest to the camera and call out to the correct planet to actually draw the pixel. This lets us add several planets to the scene and have them sort correctly. (In the future, we might allow a planet to specify transparency, so you could see one world through the atmosphere of another.)

Second, I used the scheme described by Paul Bourke at the top of this web page to add some fractal terrain to the planet. It's a very simple concept; I actually wrote a version of it for a CS project back in college. You choose random slices through the sphere, increase the altitude of all points on one side of the slice, and decrease the altitude of all points on the other. When repeated several hundred times you end up with surprisingly good-looking results.

At this point I feel I should clean up the code and see if I can get it running at anything close to real-time. That's my general goal for this weekend.
Tags: 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.