Monday, 20 November 2006

Ray tracer

Just uploaded a new F# example program with executable and complete source code:


Tommy Carlier said...

You can still speed up your raytracer.

In your render(form) function, replace form.Invalidate() with form.Invalidate(new Rectangle(0, y, form.Width, form.Height))

In your form.OnPaint method, instead of drawing the entire bitmap each time, you only have to draw e.ClipRectange.

Jon Harrop said...


Thanks for the feedback. I've incorporated the changes you suggest as well as some optimisations (lazy evaluation of the surface, not shooting shadow rays from the dark side of an object and some other things).

I've also added a simple GUI, with bitmap saving and the ability to disable reflections and shadows.

The save dialog is still quirky but I'll upload the new version ASAP. It is still <250LOC!