Making an iterative example of ray_color function. #929
Replies: 5 comments 3 replies
-
Someone suggested tail recursion to do the function, but isn't the end of the tail of ray_color some combination of the background color? Why would the background color be a factor in the ray of the sphere, and if it's not doing that, then the tail is black, and black multiplied by any color is black. So I'm just guess the contribution of the background is so little it's irrelevant. Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
If you can read cuda, I would recommend reading the section within https://developer.nvidia.com/blog/accelerated-ray-tracing-cuda/ entitled |
Beta Was this translation helpful? Give feedback.
-
Faced this exact problem some while back. Found the solution in another repo which had a raytracer implemented as a fragment shader. Can't quite rediscover the repo now. You can take a look at my solution here: @trevordblack Thanks for the article. Wish I had stumbled upon that when I was struggling with this. |
Beta Was this translation helpful? Give feedback.
-
I brought this up in one of the issues. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is still relevant, but I've got implementation of iterative |
Beta Was this translation helpful? Give feedback.
-
So I'm trying to make a compute shader in opengl to run ray tracing in one weekend inspired code, but I'm finding it hard to turn ray_color into an iterative function. Shaders in GLSL or HSL can't do recursion, and in college I was never taught how to transform them. I know the most common way is to make a stack array, but honestly this is very confusing how to apply it to ray_color, any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions