Class TPathTracer

Unit

Declaration

type TPathTracer = class(TRayTracer)

Description

Path tracer. See [https://castle-engine.io/vrml_engine_doc/output/xsl/html/section.path_tracer.html] for documentation.

Hierarchy

Overview

Fields

Public MinDepth: Integer;
Public RRoulContinue: Single;
Public PrimarySamplesCount: Cardinal;
Public NonPrimarySamplesCount: Cardinal;
Public DirectIllumSamplesCount: Cardinal;
Public SFCurveClass: TSpaceFillingCurveClass;

Methods

Protected procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); override;
Public constructor Create;
Public procedure Execute; override;

Description

Fields

Public MinDepth: Integer;

MinDepth and RRoulContinue together determine the path length. The path has at least MinDepth length, and then Russian roulette is used.

See [https://castle-engine.io/rayhunter.php] documentation about "<recursion-depth>" and --r-roul-continue for suggestions about how to use these parameters. See also [https://castle-engine.io/raytr_gallery.php] for some experiments with these values.

RRoulContinue must be in 0..1 range.

You can give RRoulContinue = 0 if you don't want to use Russian roulette at all (works OK because our comparison Random < RRoulContinue uses "<", not "<="). Note that this causes bias (result is darker than it should be). Only RRoulContinue > 0 removes bias (the expected result is the correct one).

Small RRoulContinue values cause a lot of noise. Large RRoulContinue values cause long rendering.

MinDepth must be >= 0. You can use MinDepth = 0 to disable "minimal path length", and use Russian roulette always (noisy).

Public RRoulContinue: Single;
 
Public PrimarySamplesCount: Cardinal;

How many paths to use. Both must be > 0.

PrimarySamplesCount tells how many paths are used for primary ray, and is really useful only for anti-aliasing. You can set this to a few. Values above ˜10 are useless, they cause much longer rendering without really improving the result. You can set this to 1 if you don't need anti-aliasing.

NonPrimarySamplesCount is the number of paths caused by each hit of a primary ray. This is the main quality control for the path-tracer, more paths mean that colors are gathered from more random samples, which means that final color is more accurate. In total you have pixels count * PrimarySamplesCount * NonPrimarySamplesCount, so beware when increasing this: you really have a lot paths.

Public NonPrimarySamplesCount: Cardinal;

How many paths to use. Both must be > 0.

PrimarySamplesCount tells how many paths are used for primary ray, and is really useful only for anti-aliasing. You can set this to a few. Values above ˜10 are useless, they cause much longer rendering without really improving the result. You can set this to 1 if you don't need anti-aliasing.

NonPrimarySamplesCount is the number of paths caused by each hit of a primary ray. This is the main quality control for the path-tracer, more paths mean that colors are gathered from more random samples, which means that final color is more accurate. In total you have pixels count * PrimarySamplesCount * NonPrimarySamplesCount, so beware when increasing this: you really have a lot paths.

Public DirectIllumSamplesCount: Cardinal;

How many samples are used to calculate direct illumination at every path point. These are rays sent into random points of random light sources, to test if given light shines here.

Set this to 0 to have a really naive path-tracing, that wanders randomly hoping to hit light source by chance. This will usually need an enormous amount of PrimarySamplesCount * NonPrimarySamplesCount to given any sensible results.

Set this to 1 or more for a normal path-tracer.

Public SFCurveClass: TSpaceFillingCurveClass;

Order of pixels filled. In theory, something like THilbertCurve or TPeanoCurve could speed up rendering (because shadow cache is more utilized) compared to TSwapScanCurve. But in practice, right now this doesn't give any noticeable benefit.

Methods

Protected procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); override;
 
Public constructor Create;
 
Public procedure Execute; override;
 

Generated by PasDoc 0.16.0.