Exception program called when using recursion

Hi all,
For the past few months we have been modifying the path tracer demo to create a program that lets the user create their own material programs with multiple BRDFs. However we have run into a little bit of a wall. The way our path tracer works is for every pixel a ray is traced and a material program is called. That material program then deals with sending off its own ray’s to calculate the BRDSs that it may include making our path tracer very recursive. However It seems to only get to around depth 4 when the exception program is called. I think it could be that we are running out of stack. Is there a way to test if this is the case and this does turn out to be the problem is there a way we can increase our stack size?


You shouldn’t have to guess what the problem is. Print out the error message from your exception program and then you’ll know if you’re running out of stack. Read the documentation for rtPrintExceptionDetails().

Have you looked at the rtContextSetStackSize() command in the OptiX documentation?

Fantastic! That solved it, thank you!