5 ms·
Such a nice job on the visuals and interactive components! It takes a lot of work to craft a post like that. I think it’s worth mentioning the ray marching (si
by dahart 5y ago
Such a nice job on the visuals and interactive components! It takes a lot of work to craft a post like that.
I think it’s worth mentioning the ray marching (signed distance field) method for creating rounded boxes, because of how surprisingly simple it is - a single subtraction added to the sharp-cornered box does the trick. Even more fun, and relevant to the Apple story, it works exactly the same in 2d, and it can be used to anti-alias your 2d rounded boxes beautifully! (Useful if you want to render dynamic-radius rounded corners in real-time.)
https://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm https://www.iquilezles.org/www/articles/distfunctions/distfu...
- wnkrshm 5y agoSDFs are nice but to make a nice triangle mesh, you'll have to sample points on the isosurface, by geodesic distance.
- dahart 5y agoTrue! Yes, and this is a good summary of how the 2d anti-aliasing I mentioned works. Of course SDFs aren’t the only alternative to a mesh-free rounded box, there’s also ray-rounded box intersection. I think IQ has one of those too?
- danwills 5y agoI agree it's utterly astounding what can be done with 'analytic' (ie 'vector' vs 'rasterized') SDFs, (and different ray-intersection/marching methods too) and what IQ does and how much he shares the actual code and ideas just fills me with gratitude every time I read/watch! Cheers for the link above, i'm definitely gonna have a play with some of those functions!
- high_byte 5y agoI'm still looking for my jaw after his painting with math girl
- danwills 5y agoI think the most common approach to convert SDF to polygons is called 'marching cubes' and it yields triangles and quads, but I guess you can always 'convex' (halve) the quads afterwards to get 100% triangles. It will most probably not be as neat and tidy as the mesh in the article though! If you can identify lots of locations of points on the isosurface, it could probably be fairly easily triangulated in this case too since a rounded cube is a fairly simple and convex shape.. but the result will also be inherently noisy I think. Guess it's all about the use case eh?