Archive for the 'Experiments' Category

Resizing Single-Image-Rollovers Using jQuery

In this article I describe how to create shaped buttons in HTML/CSS that size to their content, have roll-over state, and require only a single image, using jQuery.

Debug.Assert Considered Pointless

One thing I was told as a young programmer was to make good use of assertions for checking code. As time goes by however, I can see less and less use for assertions. I’m starting to think they’re pretty useless.

Using WPF To Generate Web Images

Recently I needed to display rotated graphics within a web-page. Since there’s no way to do that cross-browser using CSS, I needed to auto-generate a collection of pre-rotated images that could be displayed as CSS sprites. I’ve found that WPF (Windows Presentation Foundation) is great for generating batches of images suitable for use in web [...]

LINQ-to-Entities: Follow-Up

There’s been a bit of discussion about my last article, “LINQ-to-Entities: The Blackberry Storm of ORMs?“. I thought I’d try to clear up a bit of what I was trying to say, especially with regards my statement about LINQ-to-Entities returning differing values depending on code order.

LINQ-to-Entities: The Blackberry Storm of ORMs?

(In case you missed the reference, the new Blackberry Storm has been widely slammed as an inferior copy of the iPhone, and was released basically unfinished to try to fend off its better rival).
Note: the first part of this article is a bit of an opinionated rant – if you want to skip to the [...]

Experiments in Ray-Tracing, Part 9: Interpolation

In this article I’m going to present a technique that trades lower image quality for faster rendering time: interpolation.
Instead of ray-tracing every single pixel, we instead start by tracing pixels in an evenly-spaced grid, say every two or four pixels. (So if we have an interpolation step of two, we trace one out of every [...]

Experiments in Ray-Tracing, Part 8: Anti-Aliasing

In this article I’ll explain how to perform anti-aliasing quickly, getting 5x sampling for a cost of just 2x the time.
Anti-aliasing is a technique to remove the “jaggies” in a rendered image. Let’s start with the standard shiny-balls-on-a-chessboard:

I’ve zoomed into the image a little, so that you can see the pixellated edges.
Anti-aliasing is most simply [...]

Experiments in Ray-Tracing, Part 7: Multi-Threading

Now that I’ve covered the basics of ray-tracing, I’ll cover a few optimization techniques I’ve tried. Optimizations can be placed into three broad categories:

Those which speed up the ray-tracing, without affecting the image;
Those which speed up the ray-tracing, but degrade the image quality, and;
Those which improve the image quality, but slow down the ray-tracing.

Obviously implementing [...]

Experiments in Ray-Tracing, Part 6: Intersection Tests

I wasn’t going to present quite so much code in this series, but the following intersection tests are (a) tricky to get working correctly and quickly, and (b) they’re not exactly exciting, so I thought I’d include them here as reference. I’ve also been saying things like “if the ray intersects the object…” without covering [...]

Experiments in Ray-Tracing, Part 5: Reflections

Reflections are so easy to implement in a ray-tracer, it’s not suprising that so many ray-traced images contain them. To implement reflectivee surfaces, we need to extend (or composite) our materials to support a reflectivity factor – this ranges from zero (absolutely no reflections) to one (a perfect mirror). Equally, as the reflectivity ranges from [...]