Thursday, 15 January 2009

Visual Adrenaline

I just love Intel's "Visual Adrenaline" magazine. It's such an unabashed marketing vehicle! This month there's a real treat in the form of a article by Daniel Pohl on his new ray traced version of the game Quake Wars. It was this paragraph at the beginning that really got my goat (my emphasis): "Today’s games all use a rendering technique called rasterization. Rasterization requires difficult programming work and as many special effects (such as shadows or reflections) need to be calculated as approximations over multiple rendering passes and are often stored in resolution-limited textures in between." (sic) Now, don't get me wrong, I love ray tracing, and I think that soon (like in the off-line rendering world) real-time graphics will probably converge to a hybrid model that uses rasterization with ray-tracing effects where they make sense. But to claim that rasterization requires "difficult programming work" and is any more of an approximation than ray tracing is just misleading. Rendering is all an approximation, and real-time rendering is more approximate than most. Sure, it's easier to to do hard edged shadows using ray tracing, just shoot another ray, but start adding soft shadows and you might start wishing you had a shadow map to blur. And what about the "difficult programming work" and run-time cost of constructing the spatial data structures which are essential to make ray-tracing perform decently? Ray tracing advocates too often ignore this. He then actually goes on to discuss in detail how badly ray tracing handles the alpha-tested trees in the game because of the thread divergence this causes. He says: "Another advantage of using a ray tracer for partially transparent objects is that they don’t need to be sorted by their depth" Err, I believe the trees in Quake Wars are rendered using alpha-to-coverage, so no sorting is necessary. (Addendum: you could also argue that ray tracing is also essentially doing a sort by traversing a spatial data structure of the scene and returning the closest hit.) The final icing on the cake is the image above, which is supposed to show ray-traced refraction, but as far as I can tell doesn't actually show the back faces of the dome and thus spectacularly fails to demonstrate an actual benefit of ray tracing!

5 comments:

levelofdetail said...

This article was also featured in Game Developer magazine. It was bothersome to me also. The arguments are weak and the demonstrative images are worse.

Eric said...

I'm more positive on this article simply because it's showing work in progress and points out some interesting problems for ray tracing. I have a great hype filter, and honest don't care about ray tracing vs. rasterization arguments at this point - such discussions are only a bit more premature than arguments about the use of quantum computers.

As far as the refraction goes, I didn't mention it on my blog but this "feature" is immediately caught by my hype filter. If you think about how refraction works, thin glass plates (such as the dome should actually be made from) will divert rays only a tiny bit from their final destinations: the ray direction changes entering the glass, moves a tiny bit through the glass, then exits the glass and goes the original direction again. So you wouldn't see any noticeable effect of refraction even if the backfaces were present. Thick transparent objects with curved surfaces are where refraction effects will really show.

As it is, I don't see any refraction effect anyway - if there, it's darn subtle. I suspect the glass dome was not modeled with thin plates of glass anyway, but just "one side" of each plate. So if refraction was really happening, it would be as if the volume inside the dome was filled with glass. Like I say, I basically don't care so much about this feature (I know it can be done, though it's usually quite expensive since rays get spawned). The good bit is that there are true reflections per plate combined with (essentially) transparency.

visual_adrenaline_editor said...

Hmmm... unabashed marketing, hype filter... what content do you want to see in the magazine?

Eric said...

Heh, like I say, I'm fine with the article, in fact. It's not meant to be heavyweight, and I liked it - see my blog post on the same article. I did not say the article had a lot of hype, but rather there were small bits where the author waxed poetic or cast ray tracing in an optimistic light. That's how it should be for a researcher (much better than "this algorithm is hopeless, but I guess I'll keep trying"), and there are areas to be optimistic about.

On the technical side, I believe Daniel has made an error talking refraction with the dome image. The image itself shows little refraction (as best as I can tell - I hope Daniel puts these shots on his website). Nor should it, given that the walls are meant to be plate glass. I think this is just a "thinko", as Jim Arvo puts it, a little mental error. I could be wrong. The good part of the image, like I say, is true reflections combined with transparency. It indeed does look like back-face culling is on - oops. Not a big deal; no need for a tempest in a teapot dome scandal.

By "hype filter" I mean I merely skip over such bits, they're no big deal and I don't worry about them. "To pump up your visual adrenaline level" - immediately eaten by the filter; fine wording for this semi-technical publication, and fine for me to ignore.

Another more interesting passage: "With ray tracing, you only need to check if the path from the light to the surface is blocked or not. This can be easily determined with just a ray (the so-called "shadow ray")."

"Only" and "easily" hide a lot of complexity underneath the hood needed to make shadow-casting run even near real-time. But this passage isn't anywhere near full-grade rubber-meets-the-sky marketing hype. If anything, it's self-denigrating of Daniel's own achievements. I think the intent of the sentences is to point out that the theory of ray tracing is simple, whereas many rasterization-based algorithms are pretty involved. Implementing that simple theory so that it fits well with today's core architectures has been the challenge.

The trees example is a great case in point: using a simple "hit, then spawn a new ray" algorithm for ray tracing cutout objects results in a lot of additional rays getting spawned. It's interesting to think of how to preserve the original ray and just add in the effects of intersections.

Long and short, I still like the article, it's fine for what it does. It's unfortunate that some of the phrasing makes it sound like ray tracing is just plain simpler than rasterization. Simpler to explain to your mother, yes; simpler to program, not really. Each has their uses.

Simon Green said...

Hmmm... unabashed marketing, hype filter... what content do you want to see in the magazine?

The content is fine, but I do think the obvious marketing spin does undermine it, at least to the technical audience which your magazine is presumably aimed at (as evidenced by the comments here).

And if I see another game that has some pointless ray-traced reflective spheres added it to it, I think I'm gonna shoot myself!