-
Task
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
There is interest in this because Figma and Rive (and probably other tools) allow adding shadows to arbitrary shapes; and after the patches to expand strokes to arbitrary width in the vertex shader (and also get rid of some of the overlaps), we are guessing that the code can be reused to get shadows done efficiently as well.
In practice, rectangular shadows are likely to be the most often used. We already have https://doc.qt.io/qt-6/qml-qtquick-effects-rectangularshadow.html (which is lacking support for different radii on each corner) and Kirigami has https://api.kde.org/qml-org-kde-kirigami-primitives-shadowedrectangle.html Those are both using smoothStep() to generate the shadows; so we might be able to do that here too. On the other hand, it may not look the same as the gaussian blur that is often used when generating shadows with an image-processing technique (render the shape first and then do a convolution on the texture afterwards). So we'll see about that; in any case, it will be easy enough to swap out the function in the fragment shader, as long as it can be expressed as a function of distance along the curve normal, which fades to 0 (alpha) at a sufficient distance.
It may be that RectangularShadow will always be more efficient: this probably needs benchmarking. So maybe it will be recommended to keep using it when possible, and/or maybe we can detect that a shape is actually just a (rounded) rectangle and automatically apply an optimization. But that's low priority I suppose.
It seems that Rive does not care about overlapping triangles: they use the winding rule to prevent rendering the same pixels more than once. So perhaps that is also worth a try, if we cannot get rid of all the overlaps.
- relates to
-
QTBUG-132764 make stylus "ink" useful in Qt Quick: drawing, saving, loading, rendering
-
- Open
-
-
QTBUG-124638 Shapes: Implement support for cosmetic pens
-
- In Progress
-
-
QTBUG-94171 Add per-corner Rectangle radius property
-
- Closed
-