Hairy Stuff

01 Feb 2018

Last month I was working on a lot of new test scenes for my Rust implementation of the PBRT renderer. But a big chunk of my time went into implementing the curve shape needed for the geometry of hair, and a material, which implements a hair scattering model.


Both test scenes come originally from Cem Yuksel, but can be downloaded by cloning a git repository described here.

Curly hair provided by Cem Yuksel

The image above was rendered in 1024x1024 resolution with 1024 pixel samples, using a HDR image, instead of the Portable FloatMap Image Format (PFM).

> rg Film -A 1
6:Film "image"
7-   "integer xresolution" [ 1024 ] "integer yresolution" [ 1024 ]

5:Film "image"
6-    "integer xresolution" [ 1024 ] "integer yresolution" [ 1024 ]
> rg hdr
1100028: LightSource "infinite" "string mapname" [ "textures/Skydome.hdr" ] 

3291601: LightSource "infinite" "string mapname" [ "textures/Skydome.hdr" ]

BTW the rg program used above is called ripgrep and is a line-oriented search tool that recursively searches your current directory for a regex pattern while respecting your gitignore rules.

Straight hair provided by Cem Yuksel

The straight hair version used only 512 pixel samples.

If you want to render both scenes with my Rust implementation of PBRT I provide slighltly modified versions for download, which should work from version v0.2.7 on and later:

> tar tfvz hair_pbrt.tar.gz
drwxrwxrwx jan/users         0 2018-02-02 12:25 hair/
-rw-r--r-- jan/users 237072788 2018-01-31 11:27 hair/straight-hair.pbrt
drwxrwxrwx jan/users         0 2018-01-31 11:27 hair/textures/
-rw-r--r-- jan/users    790841 2018-01-31 11:20 hair/textures/Skydome.exr
-rw-r--r-- jan/users    113311 2018-01-31 11:27 hair/textures/Skydome.hdr
-rw-r--r-- jan/users 710196608 2018-01-31 19:55 hair/curly-hair.pbrt

So, what did I modify (and why)?

HDR instead of Portable FloatMap (PFM)

The current version of rs_pbrt does not support PFM files. You can compile with OpenEXR support using the openexr crate, but that might be tricky on some platforms, so I also support HDR via the image crate.

No include lines in PBRT

This is probably easy to fix in one of the future versions of rs_pbrt, but right now it was not on my agenda, so I simply replaced lines like this:

> rg Include
20: Include "models/straight-hair.pbrt" 

15: Include "models/curly-hair.pbrt" 

19:  Include "models/block.pbrt"

By just cutting & pasting the lines from mentioned files to replace the include lines. But I created an issue for this, so it get fixed in a future version.

Other Test Scenes

Japanes Classroom by NovaZeeke


Country Kitchen by Jay-Artist


The White Room by Jay-Artist rendered by Mitsuba


The White Room (above) comes from Benedikt Bitterli’s Rendering Resources and I rendered only a noisy version with rs_pbrt, which can be found here. The image above was rendered by Mitsuba. This is a good scene to render again, once I have implemented bi-directional path-tracing.

The Wooden Staircase by Wig42