-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A non recursive implementation of ray_color
#624
Comments
There have been a couple of public implementations in languages or environments that discourage recursion, e.g. Cuda, OptiX, OpenCL, GLSL I think that having two implementations of the main rendering loop would be overkill, and I think that recursion is the KISS version of the two. |
I also admit that recursion reads more easily, and it also models better the underlying equation. Having said that, I also noticed that through listing 34 - 40, we are slowly building up the My initial research, aka googling, showed only implementations with a call stack using preprocessor variables of the type It would be great to have at least a link to a public non recursive implementation in section 13.2: Next Steps for those who are trying to port what's here to an environment that discourages recursion. |
See: Cuda I'm not sure if we're still broadcasting this wiki page. @hollasch |
broadcasting == advertising? Not that much. It's still up and readable to the general public. I don't know if anyone with a GitHub account can edit. |
It's up and readable, but do we have a link up anywhere?
…-------- Original Message --------
On May 28, 2020, 21:18, Steve Hollasch wrote:
broadcasting == advertising? Not that much. It's still up and readable to the general public. I don't know if anyone with a GitHub account can edit.
—
You are receiving this because you commented.
Reply to this email directly, [view it on GitHub](#624 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ACNZVKDRRF43RM6463A5AITRT4ZQBANCNFSM4NMXSH5Q).
|
Looks like it's only mentioned in the src README's. We should probably note this in the project web page. |
The implementation I am seeing in the link uses a constant value for iteration, not much different than using a preprocessor directive and a call stack. However it would have been a good pointer if I had known it before. |
I have tried to implement an iterative variant of the rendering |
I would like to suggest a simple non recursive implementation for
ray_color
function to be mentioned in an alternative listing during the first book around chapter 8.I realize that it is maybe outside of the current scope of the first book, where everything is as simple as possible. However, since portability is also a concern for the first book, and it is not possible to use recursion in glsl and OpenCL, it might help to briefly at least mention a non recursive implementation from which the reader might build her own version for more complicated stuff later on.
Here is my proposition:
Note that I am not using any call stack to emulate the recursion. The function correctly renders the figure in
Rendering of diffuse spheres with hemispherical scattering
, I also ported it to glsl and it works over there as well.The text was updated successfully, but these errors were encountered: