Replies: 7 comments
-
For some concrete examples of problems I'm looking to solve, let's look at this example shape. I generate an MTSDF with these parameters: That generation takes 6:15 on a desktop Zen+ processor This MSDF produces errors immediately, even when rendering at the scale of the texture, which can be seen more clearly at magnification. islands appear between sharp corners on opposing terminals and complex arrangements of "spokes" become irregular and wavy instead of just blurry. While resolving these issues at the same output resolution will not make the rendering perfect, there is probably a way to make the artifacts less destructive. |
Beta Was this translation helpful? Give feedback.
-
And yes, I am aware how few samples I'm working with at this scale, and how fragile this is. |
Beta Was this translation helpful? Give feedback.
-
Good luck with your research. By 6:15, I hope you mean 6 seconds and not 6 minutes, but yeah, the program is not optimized to be used for many isolated shapes in this way, but more typically, a distance field would be generated for each glyph separately. Thin lines and narrow gaps are a big issue for discretely sampled distance fields in general, but using the new option |
Beta Was this translation helpful? Give feedback.
-
🙊
Yeah, there is no free lunch, and I'm not trying to discover a proof against the Whittaker–Nyquist–Shannon theorem here.
I did also look at more channels, that's tough since selecting one of three channels is easier than selecting one of four, though maybe the same operations work fine on four channels (that would completely resolve these four-corner conflicts, if it worked). |
Beta Was this translation helpful? Give feedback.
-
I was thinking more along the lines of 5 or 7 channels, where the same algorithm (taking the middle value) can be applied. This has the obvious downside of not being representable by a single texel, so a special mapping and a shader that takes two samples would have to be used, but I think there could be some very specialized use cases where this would actually be a good solution. |
Beta Was this translation helpful? Give feedback.
-
Five channels seems pretty reasonable overall; at least two three- or four-component textures and samplers in a fragment is the norm anyhow, in most work GPUs do; texture samplers are kinda built for this. The question is, does this win over just doubling the number of texels and sticking to three channels? I guess it would depend on the shape. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have been using msdfgen a bit, on a variety of different kinds of paths and shapes.
In general I am satisfied with its performance, but the analytic approach to producing MSDFs seems to run into five-PhD edge cases, and its performance degrades rapidly as you add segments to your path.
I think that an optimization based approach could solve all of these problems at once, and can take place primarily on the GPU if desired.
The general idea in my head is:
An additional benefit of this approach is that it works on arbitrary input images, and can produce soft regions instead of hard aliasing when the SDF resolution is too low. This is particularly helpful for shapes with many small holes, where the analytical approach is inefficient and error-prone.
I will go ahead and try my hand at this problem; I'm putting up this issue to track ideas and conversations about this, and gather ideas in case anyone else here has thought about this.
Beta Was this translation helpful? Give feedback.
All reactions