Closed vitalitylearning2021 closed 1 year ago
Hi,
Only CustomProj... camera modes are using buffers with (various) ray info provided by the user. These buffers stay constant in all accumulation frames. Other modes are calculating rays on the fly with camera shader programs.
Rays calculated by shaders are crossing each pixel of the 2D image, 1 ray - 1 pixel. In the first accumulation frame rays are distributed regularly, each ray is crossing the center of its corresponding pixel.
Image ray traced with a single accumulation frame can be noisy - rays in neighbouring pixels can be scattered in different directions if they hit diffuse surface. This is the first motivation for the multiple accumulation frames. Shooting many rays in the same direction and averaging radiance calculated along their paths gradually smooths out the resulting image.
Second effect is aliasing on the object edges and potential interference of the regular distribution of rays with the pattern of objects in the scene, causing ugly (and not realistic!) moiré patterns. Correct solution is to sample the scene with multiple rays randomly distributed within the pixel. So starting from the second accumulation frame there is a +/-0.5x0x5 pixel jitter added to the calculated ray direction.
In custom camera projection modes, ray info is corresponding exactly to what you provide in buffers if your ray tracing resolution matches the buffers shape, but only in the first accumulation frame. In the next frames values are interpolated according to the random jitter. Normally you limit max_accumulation_frames to 1 in custom modes, but it can depend on your goals.
Thank you very much for your answer.
My question is: when you use multiple accumulation frames, either when using shaders or a customized camera, and you access the hit points buffer by rt._hit_pos
, to which accumulation frame do you have access? The first one? The latter one? A middle one?
All values are averaged, except the primitive id buffer. Id's of hits are from the last frame.
Thank you very much. That closes the issue.
Good day, I'm using the following code:
The code uses the
max_accumulation_frames
parameter which is initially set to1
. With such a setting, I the code returns the following image representing the intersection points over the scattering surface:It seems that the impinging rays are launched in an ordered grid.
If the
max_accumulation_frames
parameter is set to2
, then the result is the following:and randomization occurs, as expected. We have however lost the old, ordered intersection points.
I have three questions about this behavior:
max_accumulation_frames
parameter above2
, is the ray buffer replaced by a new one?max_accumulation_frames
parameter?Thank you very much for your help.