Outdoor Rendering

I’ve been doing lots of renders that have shown objects in a dark room, or in a cornell box, but I haven’t shown many objects in coloured outdoor environments.

Well, it’s time to correct that, and path tracing is a good excuse to get some really nice renders out of the engine. One of the things that’s made the indoor scenes difficult to render is the extremely high dynamic range. There’s a small sphere of extremely bright light and whenever that ends up getting sampled for diffuse lighting it adds a bright white sample. You have to oversample a huge number of times before those spikes start to even out and the noise disappears.

With an outdoor scene you can get much smoother renders with the same amount of sampling because the light is evenly distributed throughout the scene. For example lets look at the cornell box render from the last path tracing article…

Raytracer with path tracing, cornell box

Cornell box scene, 500 samples per pixel. ouch..

As mentioned in that article the amount of noise is mental, and that’s with 500 samples per pixel. Now lets try an “outdoor” scene with a pale blue background. This gives a far more pleasant result with the same number of samples…

outdoor sphere rendering

Spheres with an all around background colour

And incidentally this is taking a mere 3 minutes to render following some serious optimisations I did over the past few weeks. (happy times)

There is something missing from this scene though. Usually in an outdoor scene there’s more than just a blue sky, there is actually a directional light coming from that massive ball of fire in the sky. I’ve already written the code for a directional light, but I need to generate soft shadows so I’ve added a noise setting for the direction to simulate a basic spherical light.

DVector3 direction = mDirection;
DVector3 jitter = DVector3(
jitter *= mArea;
direction += jitter;

Lets have a look at the same scene with a directional light added to the mix…

Path traced spheres

Path traced outdoor scene with directional light

I’m a lot happier with these images and you can see some really subtle lighting effects on the spheres.

The next thing to do is surely to render a menger fractal and see how cool that looks?

Path traced menger fractal

Menger-type fractal render using path tracing and outside lighting setup

Again there’s a lot of hidden subtlety in this image. The surfaces are a little glossy so the reflections are imperfect, there’s a small amount of depth of field, and you can see some lighting bouncing around inside the fractal.

I guess one day I’ll have to distribute the executable in case you want to have a go with it. Anyone interested?

And a final bit of audience participation… what do I do next?

I can spend a few weeks researching path tracing, I can finish off the transparent object rendering engine, I could do a Mandelbulb raytracer, or a generic voxel raytracer, or maybe bump mapped surfaces like water?

Happy to take requests.

You may also like...

2 Responses

  1. Neil Danson says:

    +1 for voxels from me :)

    • Dom Penfold says:

      Hi Neil,

      I am definitely going to come back to voxels, but I’ve got stuck into writing my own scripting language (WooScript) for building procedural objects. I’ll add an update on that soon.

Leave a Reply

Your email address will not be published. Required fields are marked *

Spam Protection *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>