▲ | Lichtso 18 hours ago | |||||||||||||||||||||||||
> The next step is to work with chains of Bézier curves to make up complex shapes (such as font glyphs). It will lead us to build a signed distance field. This is not trivial at all and mandates one or several dedicated articles. We will hopefully study these subjects in the not-so-distant future. If you only want to fill a path of bezier curves (e.g. for text rendering) you can do without the "distance" part from "signed distance field" [0], leaving you with a "signed field" aka. an implicit curve [1]. Meaning not having to calculate the exact distance but only the sign (inside or outside) can be done without all the crazy iterative root finding in an actually cheap manner with only four multiplications and one addition per pixel / fragment / sample for a rational cubic curve [3]. [0]: https://en.wikipedia.org/wiki/Signed_distance_function [1]: https://en.wikipedia.org/wiki/Implicit_curve [2]: https://github.com/Lichtso/contrast_renderer/blob/a189d64a13... | ||||||||||||||||||||||||||
▲ | ux 18 hours ago | parent | next [-] | |||||||||||||||||||||||||
Finding the sign of the distance has been extremely challenging to me in many ways, so I'm very curious about the approach you're presenting. The snippet you shared has a "a³-bcd ≤ 0" formula which is all I get without more context. Can you elaborate on it or provide resources? The winding number logic is usually super involved, especially when multiple sub-shapes start overlap and subtracting each other. Is this covered or orthogonal to what you are talking about? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | vlovich123 14 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||
But real shadows and lighting would require the distance aspect, no? The distance is only irrelevant for plain 2D text rendering, right? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | cubefox 13 hours ago | parent | prev [-] | |||||||||||||||||||||||||
I wonder which method Apple is using for their recently introduced Bézier curve primitives for real-time 3D rendering in Metal. From their WWDC 2023 presentation [1]: > Geometry such as hair, fur, and vegetation can have thousands or even millions of primitives. These are typically modeled as fine, smooth curves. Instead of using triangles to approximate these curves, you can use Metal's new curve primitives. These curves will remain smooth even as the camera zooms in. And compared to triangles, curves have a more compact memory footprint and allow faster acceleration structure builds. > A full curve is made of a series of connected curve segments. Every segment on a curve is its own primitive, and Metal assigns each segment a unique primitive ID. Each of these segments is defined by a series of control points, which control the shape of the curve. These control points are interpolated using a set of basis functions. Depending on the basis function, each curve segment can have 2, 3, or 4 control points. Metal offers four different curve basis functions: Bezier, Catmull-Rom, B-Spline, and Linear. (...) 1: https://developer.apple.com/videos/play/wwdc2023/10128/?time... |