2 ms·
For realistic rendering with signed distance functions, you already need to know certain material properties at each point such as color, specularity, reflectiv
by yorwba 7y ago
For realistic rendering with signed distance functions, you already need to know certain material properties at each point such as color, specularity, reflectivity and so on. "Hatch direction" could simply be specified as one of those properties.
I see the greater hurdle in marrying the sampling-based nature of SDF rendering with MetaPost's vector graphics. You'd probably need a rasterized image at high resolution (which includes the "hatch direction" information for each pixel) and then approximate it with vector strokes.
- sergeyslyusarev 7y agoIf you do have such data, it should be possible. At least in theory. In practice, yes, probably the easiest way would be to have a flat image with depth (or "lightness") and hatch direction information processed by MetaPost somehow. What the library is missing now, is an algorithm which would convert some arbitrary field of directions into actual hatches: the problem is that you need to have more or less uniform "black" without too "dense" or too "loose" areas; this problem in this library is solved for some particular cases (when tube width changes, the number of strokes also changes in order to keep approximately the same stroke density, for example), but the general solution with reasonable results is probably much trickier. With all that said, MetaPost probably isn't the best tool to deal with "real" 3D problems, and implementing (and re-implementing) these algorithms in some conventional 3D software could be a better option.