Lifecycle Hooks
In order to be notified about the state of the path tracer, lifecycle hooks are available. They are handled as event listeners and will be called with information about the current state.
onSampleStart
To be notified before a sample start, attach an onSampleStart
listener.
strahlConfiguration.js
runPathTracer(target, model, {
onSampleStart: ({ cameraPosition }) => {
console.log(cameraPosition);
},
});
cameraPosition
— corresponds tomatrixWorldContent
as configured in View Projection.
onSamplingFinished
To be notified after all samples were taken, attach an onSamplingFinished
listener.
strahlConfiguration.js
runPathTracer(target, model, {
onSamplingFinished: ({
bvhBuildTime,
fullRenderLoopTime,
allRenderTime: renderAgg,
renderTimes: renderTimes,
}) => {
// process
},
});
bvhBuildTime
— defines how long it took to build the BVH on the CPUfullRenderLoopTime
— measures wall-clock time of the render loopallRenderTime
— sum of all render timesrenderTimes
— array of render time measurements. This measure how long the rendering process took per sample.