Submitted by , posted on 27 June 2003



Image Description, by


Look at the picture. It's a classic raytraced image with reflecting spheres. Not impressed? Let me enumerate the features of the raytracer which rendered it :
  • Sub-pixel accuracy
  • Cast shadows
  • Arbitrary number of spheres
  • Arbitrary number of omnidirectional light sources
  • Reads the scene definition from a text file
  • Produces 24 bit raw images of arbitrary size
  • 100% written in C, without using any external library
  • Still not impressed? What if I told you the complete source code is 1971 bytes long?

    Yes, it's not a typo. One thousand, nine hundred and seventy one bytes of C code. And it could be reduced a little more in expense of "clarity".

    You can download the source code and a demo scene at http://www.mrio-software.com/2k_raytracer.php.

    Gabriel Gambetta



    [prev]
    Image of the Day Gallery
    www.flipcode.com

    [next]


     


    Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
    Please read our Terms, Conditions, and Privacy information.