Results 1 to 10 of 10

Thread: A real time ray tracer :)

  1. #1

    A real time ray tracer :)

    I somehow got the idea to make a real time ray tracer, and it turns out it?¢_Ts one of the most fun things to write, you implement everything yourself and there?¢_Ts actually very little code. Right now it doe's Phong shading, shadows, reflections and sphere and plane primitives. Planning to (eventually) add texturing, more primitives, normal displacement and CSG.


    Move about with FPS'ish controls, press L to see how adaptive sampling acts. You'll need a lot of CPU power.
    http://legion.gibbering.net/paulius/RaytraceV01.zip

  2. #2

    A real time ray tracer :)

    Wow that is so cool!! :shock:

    There's something strange with the fps though, cause when I pressed L for the adaptive sampling, things movent noticebly more slower. The fps however stayed the same. (32~35).

    Looking forward to see more of this!

  3. #3

    A real time ray tracer :)

    There's something strange with the fps though, cause when I pressed L for the adaptive sampling, things movent noticebly more slower. The fps however stayed the same. (32~35).
    I was predicting fps only from time taken by sampling, not including the actual rendering. The slowdown is strange, cause after pressing L the only thing that changes is that quads between sampled point's don't get filled, which theoretically could only improve performance :scratch:

  4. #4

    A real time ray tracer :)

    There are many skillful programmers on Litwa

  5. #5

    A real time ray tracer :)

    Texture mapping done, with a big slowdown though.

    http://legion.gibbering.net/paulius/RaytraceV02.zip
    Some new controls to play around with:
    R - toggle reflections
    1,2,3 - adjust maximum subdivision count

    About the slowdown Traveler described, it seam's non existent on nVidia card's, small on intel's, and horrible on ATI's, at least on those I tried. Anyone knows how come OpenGl's GL_LINE glPolygonMode give's these strange results on different cards.

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    A real time ray tracer :)

    Very nice.

    Mind you it toggles between 2 and 3 FPS when I set it to 3 polyphony and turn on reflection.

    It goes blank when I turn on the L function. But to explain all of this read my system specs below.

    My NEC VERSA SXi:
    CPU = Intel Pentium III 800 MHz
    Memory = 512 MB SDRAM PC133 or 166, not sure
    Video Card = "ATI RAGE MOBILITY-M1 AGP" 8MB of video ram(extended via AGP to 32)
    OS = Windows XP Professional
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7

    A real time ray tracer :)

    This is a very cool thing indeed. There's something unusually satisfying moving around a scene and have it accurately reflected in the objects, especially moving up close to a sphere.

    I've not tried the texture mapped version yet, just the first one, but the speed on the first one was fine.

    As for the speed hit on wireframe mode -- well, I've heard that some graphics cards emulate wireframe mode by making the lines out of small polygons, but FWIW I noticed no major speed decrease in wireframe mode with my ATI card. I'll try the later version and will let you know if that's still the case.
    "All paid jobs absorb and degrade the mind."
    <br />-- Aristotle

  8. #8

    A real time ray tracer :)

    Hmm I loooove these kind of topics !

    That's a very impressive stuff. Do you plan, by chance, to release the source code ?

    Now for my comprehension : how is OpenGL handy for such kind of thing ? As far as I know, a raytracer does not render using polygons, so a basic plain DirectDraw or GDI surface with a good SetPixel() function should be enough.

    Perhaps are you using OpenGL to speed-up the final blitting to the screen ?

  9. #9

    A real time ray tracer :)

    Do you plan, by chance, to release the source code ?
    Sure thing, I'll release the source code when it'll be more complete and some cleaning up is in order.
    how is OpenGL handy for such kind of thing ?
    Classical, cheatless ray tracing, where ray's are traced for every pixel, is very slow and hardly doable in realtime. I cheat a lot here :twisted: . I exploit the fact that the color of an object doesn't change much in nearby pixels, trace fewer rays, if they didn?¢_Tt hit the same object then trace more ray's, otherwise I interpolate between them, and by using OpenGL I get almost free quad interpolation done by hardware, not to mention bilinear filtering and other cool stuff, and also a possibility to do polygonal rendering on top of it. Of course because of this some limitations are introduced and there are sampling artifact (like poor specular highlights on spheres from a far, and missing very small objects), but it's a sacrifice I'm willing to make.

  10. #10

    A real time ray tracer :)

    I felt a little ashamed of not doing anything for a long time, trying to figure out some math somehow became really depressing, so at least I'll release the source code. http://legion.gibbering.net/paulius/Raytracev03.zip Not much new except infinite cylinders, and now 9 and 0 control field of view.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •