Submitted by , posted on 16 April 2001



Image Description, by


It's really suprising what (amazing) things you can do with raytracing. I built the program that generated this pics completely from scratch with no more than a simple "sink" (OpenScreen(), DrawPixel(), CloseScreen()), some simple "3D-in-4D" math (planes, spheres and rays), simple lighting rules (ambient, diffuse and specular lighting), simple optica rules (reflection and refraction), simple inheritance for classes that share common functions (like the different objects, textures, lights), and some other things ... I would say, if you want to learn program in C++, you don't want to dig in weird algorythms and you don't care about bad performances, then you should built a raytracer: it gives you the most satisfaction at the lowest costs.

The Humble Features:
  • Colored lights and Ambient, Diffuse and Specular lighting
  • Texture- and Bumpmapping
  • Reflection and Transparency
  • Refraction for viewing rays, but not for shadow rays
  • You can see it drawing pixels realtime :)
  • The Humble Scene:
  • The floor has a flat texture map, primarily specular enlighted and a little reflective.
  • The ceiling is a single colored bumpmap (very hard to see, if not impossible) and diffuse enlighted.
  • The walls are bumpmapped, texturemapped and diffuse enlighted.
  • The 3 lower balls are white, primarily specular enlighted and very reflective.
  • The upper ball is blue, very specular, very transparent and a very little reflective (very hard to see). The inside of the upper ball has a refraction index like glass (about 1.4), everything else is like air (about 1).
  • 3 point lights in 3 different colors: red, green and blue.
  • The Humble Pics:
  • Upper-left: The scene without bumpmapping.
  • Upper-right: The lighting of the scene. All textures, reflection had been disabled; transparency for shadow rays are still enabled, but not for viewinig rays. Although the floor and walls have in se the same color, the floor looks much darker; this is because the floor uses primarily specular lighting and the walls use diffuse lighting.
  • Lower-left: The lighting of the scene with all reflection and transparency enabled.
  • Lower-right: The final scene with bumpmapping.
  • The Humble Figures:
  • On a 1GHz Athlon, this scene costed 20 seconds to render at 640x480 1 ray per pixel, and 16 minutes at 1280x1024 4x4 (brute-force) rays per pixel. That makes about 20000 rays per second.
  • Anyway, Greetz to you all crazy coders,
    Bram the Bramz



    [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.