Closed Oscar-Liang closed 4 years ago
The textbook implementation differs quite a bit from the implementation we're asking you to use. Instead of using a hash table of precomputed random directions, follow the instructions in the file: https://github.com/alecjacobson/computer-graphics-shader-pipeline/blob/d15bc441fcec67d7b467b38cdac6860b28fb572b/src/random_direction.glsl#L5-L6
The textbook also gives a method for creating the random direction vector that rejects vectors outside of the unit sphere which is what's causing the freezing to happen.
You can directly create a uniform distribution of vectors on the unit sphere using the seed, which is uniformly sampled from [0, 1]^2
.
Sometimes, the entire screen freezes for ~10 seconds and then starts up again. I'm pretty sure the issue is random_direction (following the implementation in the textbook, I need a while loop). However, this seems odd, because I would think that it would either always be slow or have no issues at all because the chosen directions are deterministic. Is it alright to drop the while loop requirement in random_direction, and if not, what's causing this issue?