Ray-sphere intersection source files.
Added 2020-05-15 19:44:51 +0000 UTC
Good evening Patrons!
If you're reading this then thank you for supporting my videos! Please find attached the source files for my latest video on ray-sphere intersections.
Thank you!
Martin.
Comments
Found one problem at least: I was using cam_position = MODEL_MATRIX[3].xyz when I should have used cam_position = MODELVIEW_MATRIX[3].xyz; I'll keep going with the porting to Godot 4.2.
Randy Rosales
2024-04-21 05:18:31 +0000 UTCHi, thank you for the tutorial. Math makes sense, but I am new to Godot and trying to apply this in Godot 4.2. No luck so far. I am trying to incrementally build up the example like you did. and I am not able to get a uniform sphere of fog rendered on the inverted cube if the sphere_position is at <0, 0, 0>. If I add a bit of offset to the sphere_position, I can see the sphere just fine. But it looks like there is some kind of scaling being applied as the fragment coords approach <0, 0, 0> such that the full cube is filled with fog instead of just the specified sphere_radius portion of it. I can send screen shots if you'd like. Any ideas? They changed naming of some of the available built-in variables for VIEW_MATRIX and similar between 3.x and 4.x, but that isn't a big deal.
Randy Rosales
2024-04-21 03:58:01 +0000 UTC