Friday, May 6, 2011

CBox Unbiased Truck

I've modified the scene in the Kajiya path tracer a bit more: it now consists of a Cornell Box out of axis aligned boxes with the (in)famous truck from Unbiased Truck Soccer:

Color bleeding from the red and green wall:

The screenshots were rendered with 8600M GT (6 fps default view). On a GTS 450, the demo runs at 70 fps in default view. It should run at >200 fps on a GTX 580 with 8 samples per pixel. This new path tracer is just incredible fun, I can't stop messing with it.

Executable and source code at

UPDATE: a more challenging lighting set up with an open box only illuminated by the sky:

The truck seen from behind, indirectly lit by skylight bounced off the back and side walls. As expected with standard path tracing, the noise is a lot worse in this scenario. Bidirectional path tracing should converge faster using fewer samples.


Radiant said...

G'day its radiant again,

Really enjoy reading your blogs :)
With the mirror exe, is it possible to increase the number of bounces in the scene.

EG: have an infinite number of reflections looking in the mirror.



I remember reading on an article about this algorithm that blurs out all unwanted grain/noise in real time gpu based rendering. It happens instantly and doesn't slow down the ray tracer. If this gets implemented into tokap, it will be revolutionary.



Ray Tracey said...


yes, it's possible to increase the number of bounces by increasing the samples per pixel. Jacco Bikker has developed a novel way of implementing Russian Roulette. You can read about it here:

To increase the spp count, you must change the number of passes in the source code and recompile. If you have trouble compiling the source code, I'd be glad to help out. Some tips: use VC++2008 if possible, and download CUDA toolkit 32-bit even when you're on a 64-bit machine, you'll also need the 2010 version of cutil_math.h, the 2011 version doesn't have proper float4*float4 operator support. You can also add these lines to the 2011 version and it will work:

inline __host__ __device__ float4 operator*(float4 a, float4 b)
return make_float4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
inline __host__ __device__ void operator*=(float4 &a, float4 b)
a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w;

About the a-trous filter paper: I had already read it when it was published in May last year. While the results in the video and paper look impressive, it's only useful for blurring the noise on diffuse and glossy surfaces with low frequency textures, but doesn't work so well for specular surfaces. Nonetheless it's still worth implementing. There's some more info about the usefulness of this paper here:

Have fun compiling! Once you're able to successfully compile the source code, it's really fun changing scene elements, materials, skylight color and so on.

Ray Tracey said...

There's also a Pixar paper on reducing Monte Carlo noise in raytraced indirect illumination:

and a video:

radiant said...


I was wondering what your email/skype is. I have been getting trouble with compiling the engine and need some peer to peer walk thoughs, and also your knowledge in diving though the code.

Leave me a pm in the octane forum :)
Sorry if it is a bother for you.

Ray Tracey said...

Hi radiant. No problem at all, I'm glad to help and I'll send you a pm. I won't be able to help you right away though, since I'm currently travelling in the stunningly beautiful Canadian Rockies and only have sporadic internet access. But it's great to see someone's interested in this ;)

Anonymous said...

Nice, I hope you aren't using CUDA because Microsoft bought NVIDIA today and that means you'll need to rewrite it using DirectCompute or MR :D

Anonymous said...

Nope, Microsoft has not bought NVIDIA. It's just a deal to prevent a 3rd party to buy NVIDIA ( M$ will have rights to buy the stock 1st ), that's all.

Ray Tracey said...

Apparently, the agreement between Nvidia and MS is more than 10 years old, but it is kind of weird that Nvidia has brought it up again last week.