WebGL rotating F: Difference between revisions
m
→{{header|J}}
m (→{{header|J}}: add a bit of documentation on the approach) |
m (→{{header|J}}) |
||
Line 123:
In other words, we construct the letter F using three rectangular blocks near the origin of our coordinate system. And we construct a rectangle covering the screen using triangle strip. Finally, for each pixel on the screen we project a vector representing a potential pixel from our camera position towards the blocks.
In ray marching we find the minimum distance from an origin point to any point in the geometric structure, move in the ray direction that distance and repeat (in this case we repeat this operation 100 time for each pixel). After these iterations we have either shot past the geometry or we're within some small epsilon distance from the surface of the object. We can inspect the distance the array has progressed to determine whether we should use background color or surface color. And we can check distances with
Finally, to achieve the "rotating" effect, we
Tested in J9.03 and a J9.04 beta.
|