Skip to content
forked from xelatihy/yocto-gl

Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics

Notifications You must be signed in to change notification settings

mkanada/yocto-gl

 
 

Repository files navigation

Simple advances on Yocto/GL

This project is a simple modification to add adaptive sampling in Yocto/GL path tracer. Simply put, the integrator put samples where it is more important.

Just for comparison, take a look at the image below.

First, the 'features1' sampled with 1024 samples in the default sampler:

features1

Now, the same image, sampled with the adaptive sampler in same time (477 seconds in my computer):

features1 adaptive sampler

Note how better the refraction looks in the red ball. And the scattering is more smooth in the green bunny.

And here, the interesting sample density image:

features1 sample density

The areas with 'pure black', the pixels has 32 samples. At the brightest areas, the image has more than 65k samples!

The main idea is based in paper A Hierarchical Automatic Stopping Condition for Monte Carlo Global Illumination from where I get the pixel error estimation. Basically, the samples are put around the worst pixels measured using the formula describe in the paper. (Actually, '-log2(pixel error)', since I think that 'q 3' is more meaningful than error 0.125, and is easier to understand). The process is repeated again and again until all pixels reach a specific quality, or the time limit or spp limit is reached.

New programs

Aside a few modifications to the Yocto/GL library, all the idea is implemented in a new library called 'yocto_trace_adp' and in the program 'yscenetrace_adp'. This program has this specific options:

  • '-q ': Sample the image up to a specific quality (see below images comparing) the quality). This may be the default option. Set the quality and forget. Pratical values are between 4-6, and, and fractional values like '4.2'. Below 3.5, the image is too noisy. Above 6, too much effort for little improvement.
  • '--seconds ': Sample the image for a specified time. Great for comparison with others path tracers.
  • '--spp ': Sample the image up to a specific sample per pixel.
  • '--save-batch': This option, that already exists in original 'yscenetrace' gets a new meaning. It saves the current 'q', 'spl' and 'actual' images as the image reaches a integer quality. 'spl' and 'actual' images needs no explanation. 'q' image is what the tracer 'sees' to decide what regions needs more samples. Dark areas needs more samples. Bright areas no.

Quality comparison

Using 'features1' image as base, see the quality increasing below. Note that de noise is nearly equal in whole image, not in specific areas.

-q 0

quality 0

-q 1

quality 1

-q 2

quality 2

-q 3

quality 3

-q 4

quality 4

-q 5

quality 5

-q 6

quality 6

Next steps

A simplified 'Gradient-Domain Path Trace', as described in section 2.3 of paper A Survey on Gradient-Domain Rendering with some type of adaptive sampling.

About

Yocto/GL: Tiny C++ Libraries for Data-Driven Physically-based Graphics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 70.7%
  • C 24.4%
  • Objective-C 1.9%
  • Makefile 1.4%
  • Other 1.6%