Alex's Blog

Version 0.1

Version 0.1 adds support for a number of features, as well as enabling some that have been sitting in the code dormant for quite a while.

The first of these is support for outputting a Z-Depth pass, useful for implementing a depth of field effect to the scene, as opposed to adding the effect as part of the beauty pass. This allows the depth of field of the scene to be changed far more easily, as the Z-Depth pass takes a fraction of the time to render as a beauty pass. An example of one of these passes is below:

v 0.1 z depth example

The Z-Depth pass of the random sphere scene shown in previous entries.

In a Z-Depth pass, objects are shaded according to how far they are from the camera. Two distances are defined prior to rendering: a maximum and minimum distance. If the object is closer to the camera than the minimum distance, it is shaded as pure black, whereas any objects further away than the maximum distance are shaded pure white. Any objects between these two points are shaded according to where they are between these points. The further from the camera, the whiter the object. This results in nice gradients that, when composited with a beauty render, results in objects blurring and fading out in the distance – depth of field.

output

The above Z-Depth pass composited with the edge line composition shown from Version 0.0.4

Next is the addition of axis-aligned bounding boxes (AABB) and bounding volume hierarchies (BVH). The implementation of these largely follows the implementation by Peter Shirley in his minibook Ray Tracing The Next Week. This is for one simple reason:

His implementation works.

In time I will expand and likely replace a large amount of this code, adding support for other entities such as directional lights, but for now it is a simple and relatively elegant solution that allows Gaia to really begin to stretch her legs as a path tracer.

For a while now the code for importing a .obj mesh into Gaia has been sitting there dormant and unincluded. This is because for anything but the simplest model the amount of time it took to perform intersection tests between each ray and every primitive in the scene made it utterly useless.

However, by introducing support for bounding volume hierarchies, a complex mesh can be included in the scene without much of a performance decrease – compared to before at least.

.obj files are imported using the Tiny Obj Loader single header library, available at https://github.com/syoyo/tinyobjloaderg. All meshes are triangulated when they are loaded so that Gaia doesn’t get confused by any strange n-sided shapes.

glasscar-e1548012210562.png

A glass Mini Cooper imported from a .obj file.

There is still a long way to go with meshes. Currently they only support using a single material for the whole mesh, just like with the Mini above, and importing materials from the file is also not supported. The imported mesh also cannot be manipulated in any way, so translation, rotation and scaling of meshes will be high on the to-do list. Their inclusion does, however, allow for far more complex scenes than Gaia has been able to render up till now and as such is quite a milestone.

 

Release 0.1

Rendering methods:

  • Distributed (stochastic) path tracing
  • Monte Carlo path tracing (in-progress)
  • Edge Line pass
  • Z-Depth pass (new)

Objects:

  • Spheres
  • Quads (buggy)
  • Triangles
  • Triangle meshes from .obj files (new) 

Material BRDFs:

  • Ideal Lambertian, dielectric, metallic
  • Oren-Nayar reflectance model (buggy)
  • Blinn-Phong shading model (in-progress)
  • Diffuse area lights
  • Gooch shading

Acceleration structures:

  • In-core multithreading support
  • Bounding volume hierarchies (new)
  • Axis-aligned bounding boxes (new)

Output file types:

  • .hdr
  • .ppm

Next Post

Previous Post

© 2024 Alex's Blog

Theme by Anders Norén