1
$\begingroup$

Suppose my path tracer is shooting 64 rays per pixel (in an 8x8 grid). The confusion is, when accounting for Global illumination, should I shoot additional X number of random rays for each of those initial 64 rays? This would equal to shooting 64 * X *number of bounces rays (all sorts of) which is really large. And since I am making the path tracer on GPU memory is surely a concern.

OR I just shoot 1 random ray for indirect illumination. This would mean that the total secondary rays cast for GI would equal 64 per pixel.

The problem here is, all those 64 rays cast per pixel aren't guaranteed to intersect at the same point albeit close enough. If the intersection positions aren't the same then this would mean I am calculating indirect illumination using just 1 sample which is ofcourse very low.

Now this is again for just GI. What about Area light sources? Should I be explicitly sampling X number of rays for Area Light for each of those initial 64 rays?

I think this is what Cook mentioned in his paper on Distributed Ray Tracing. He says

Rather than adding more rays for each dimension, the existing rays are distributed in each dimension according to the values of the corresponding parameter. The key is that no extra rays are needed beyond those used for oversampling.

I am confused because mostly I have seen algorithms and code snippets following the second approach. Casting X number of rays for GI.

2) Secondly for direct illumination is the light path explicitly calculated or it's taken from the samples created for GI? The former means if I am sampling 1 ray for GI for each of the 64 rays per pixel, then I am also shooting another ray explicitly for the light path. The random sampled ray, if points to the light source I ignore it.

The latter means, I sample only 1 ray, if it doesn't hits the light source that's my GI, and if it hits the light source I accumulate it's color as direct lighting.

$\endgroup$
2
$\begingroup$

Only one path per sample.

If you had 64 bounces per first hit and 64 per second hit and so forth you'd never get an image.

Edit: And that's why you need to sample each pixel so many times (easily more than 1024 samples) in order to get it to converge, ie get rid of the noise.

As per 2) (from comment below) The 64 primary rays will not hit the same object in the same spot so you will have to calculate everything for each sample.

$\endgroup$
  • $\begingroup$ I don't understand why I'd never get an image in that first case? Can you elaborate a little. Also about my 2nd question, I think if i explicitly cast direction towards light that would be light sampling and if i am randomly casting according to the surface that would be BRDF sampling. Then MIS aims to combine both of these. Is this correct? $\endgroup$ – gallickgunner Aug 18 '18 at 5:22
  • $\begingroup$ The number of rays needed would grow exponentially depending on path depth. For 3 bounces it would be 64*64*64 rays required,adding another bounce would be *64 again, and this is all caused by a single primary ray. So the final image would need an astronomical number of rays. Also this technique would introduce statistical bias as rays at a lower bounce depth will have heavy influence based on the millions of samples their children receive. $\endgroup$ – PaulHK Aug 18 '18 at 13:42
  • $\begingroup$ @PaulHK - Aha! True. Never thought about that statistical bias. Can you also tell me about that 2nd question? $\endgroup$ – gallickgunner Aug 19 '18 at 6:10
  • $\begingroup$ The 64 primary rays will not hit the same object in the same spot so you will have to calculate everything for each sample. $\endgroup$ – beyond Aug 20 '18 at 6:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.