Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I'm a bit confused about your sqTorus2D function. Let's say the R=5 & r=3 [Torus is at origin] and let's say there is a point (6,0,0) then the function returns abs(6-5)-3 => 1-3 => -2 but this does not make sense. The point is clearly outside the torus so it should return a positive value[+1 I think]? Have I misunderstood something?
But how would you cache the previous render? If lets say the sphere gets rendered to the cube's frameBuffer and the cube gets rendered with pbr. Then when the sphere is being rendered it would have to again wait for the cube to complete its pbr calculations but then the cube would have to wait for the sphere to complete it's calculation and then....to infinity??. When the cube is rendered to the screen how would i cache that result so it can be used by the sphere. Sorry for the twisted question but i'm very confused