0
$\begingroup$

I am trying to implement next event estimation to reduce the noise of path tracer and I need a pseudocode.

Edit: I know how to sample direct illumination but the visibility function is the real problem I face. How to code the visibility function without iterating over the objects in the scene?

$\endgroup$

1 Answer 1

1
$\begingroup$

You can provide an intersect_any(ray, scene, min_t, max_t) function, that returns true at the first intersection. So it has the option to exit early compared to the usual intersect function. Additionally you do not care about normals, texture coordinates, positions, so you can avoid computing those in many cases. You need max_t though to limit the ray to the segment between the two points you are testing.

In the worst case scenario (there is nothing between the two points) you will still need to iterate over all objects unless you are using acceleration structures.

$\endgroup$
2
  • $\begingroup$ Thanks for your help. Where can I find the algorithms about ray tracing? I think Peter Shirley's books are vague. $\endgroup$
    – bitWise
    Oct 18, 2019 at 21:05
  • $\begingroup$ @bitWise There's not a single one ray-tracing algorithm. You'll have to be more specific. $\endgroup$
    – lightxbulb
    Oct 18, 2019 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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