Our quest for a wireframe renderer continues. We begin by examining Rendertoy, a tool Jeff made for visualizing renderer output that would be a lot more useful were it not for a nasty gimbal lock bug. After staring mouth-agape at whiteboard math for a while, we make a tactical retreat into the fragment shader, where we hope to find a way to remove diagonal lines across flat surfaces.
We quickly realize that the fragment shader can’t do this job without some extra information, so we run an experiment to see if adding an “erasure” vertex attribute will help. As is typical, we arrive at results that aren’t quite right, but at least we’re getting warmer.
Notes/highlights:
- Gimbal lock is a confusing problem. I’d provide an article link here but I’ve yet to find one that provides a good intuition, for me at least.
- Spherical coordinate system: https://en.wikipedia.org/wiki/Spherical_coordinate_system
- gltf-transform is a nice library for manipulating glTF files: https://gltf-transform.donmccurdy.com/
- loaders.gl is another library for loading various 3D geometry formats, including glTF: https://loaders.gl/modules/gltf/docs/api-reference/gltf-loader