Message from discussion
Mini ray tracer
Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.stueberl.de!solnet.ch!solnet.ch!news.clara.net!internal00.transit.news.clara.net!peernews.inweb.co.uk!news.freedom2surf.net!nntp-peering.plus.net!ptn-nntp-feeder03.plus.net!ptn-nntp-spool02.plus.net!ptn-nntp-spool03.plus.net!ptn-nntp-reader04.plus.net!not-for-mail
Message-ID: <427de4a3$0$39077$ed2e19e4@ptn-nntp-reader04.plus.net>
From: Jon Harrop <use...@jdh30.plus.com>
Subject: Mini ray tracer
Newsgroups: comp.graphics.rendering.raytracing
Date: Sun, 08 May 2005 02:27:06 +0100
Organization: Flying Frog Consultancy Ltd.
User-Agent: KNode/0.8.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Lines: 22
NNTP-Posting-Host: fcba3dc6.ptn-nntp-reader04.plus.net
X-Trace: DXC=NJEnWQ]T_JgBkei3e;9?nmigd3Y`7Rb;n3_LeXC3B]SiJ1mC186gYJiIPOBZSo4:oc5PCcS[NJ6<k@<m\3dY=I@h
X-Complaints-To: abuse@plus.net
I recently tried my hand at writing a ray tracer (something I haven't done
for 15 years!) and, in particular, I to write the shortest possible ray
tracer which was still comprehensible and interesting. The initial result
was a 222-line OCaml program which incrementally renders a sphere-flake via
OpenGL:
http://www.ffconsultancy.com/free/ray_tracer/index.html
I then cut this program down to a 66-line OCaml program and ported it into a
97-line C++ program. These programs are compared on this page:
http://www.ffconsultancy.com/free/ray_tracer/comparison.html
The cut-down versions don't do reflections, color or such a pretty
sphere-flake and output a greyscale PGM but they do still use hierarchical
spherical bounding volumes to accelerate rendering enough that they can
render scenes containing millions of spheres.
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com