- From: Luke via GitHub <sysbot+gh@w3.org>
- Date: Sun, 04 Sep 2016 03:11:39 +0000
- To: public-svg-issues@w3.org
Bablakeluke has just created a new issue for https://github.com/w3c/svgwg: == Photoreal gradienting: Alternatives to mesh gradient == Hello! As both a frequent SVG author and an SVG renderer implementor, the [mesh gradient element](https://svgwg.org/svg2-draft/pservers.html#MeshGradients) appears to have limited use and an awkward recursive rendering algorithm which would severely limit shader based/ GPU rendering of SVGs. So, I'd like to open a discussion for alternatives, starting with lots of noise! _Disclaimer: I haven't been following the SVG 2 specs too closely but after some searching I was unable to find any matches, so apologies if this has come up before/ is being discussed elsewhere at the moment._ **Procedural texture engines - a (very noisy) source of inspiration** If photoreal gradienting is the name of the game then I'd like to draw some attention to filter forge. It's a program for creating procedural textures as used in movies and games. Internally, filter forge uses an XML format to represent these "filters" and the results are often wonderfully realistic: ![Classic floor tiles - Created in filter forge](https://filterforge.com/filters/4351.jpg) ![Bricks - Created in filter forge](https://filterforge.com/filters/13667.jpg) ![Knitting Patterns - Created in filter forge](https://filterforge.com/filters/6014.jpg) Each filter (a tiny XML file) has input settings which can be changed by the user, resulting in an enormous variety of images resulting from the one filter. Some of these "variations" are pre-defined in the XML. They're constructed by combining relatively few noise functions in a node-based editor. This is of course a totally different approach from SVG's compositing process, however, it shows that XML can be successfully used to represent photorealistic, resolution-free imagery and that having good support for noise functions is vital for achieving that. A bonus is that it can be generated entirely on the GPU using shaders too. _(Another disclaimer! I'm not in any way related to filter forge, however, I essentially built an experimental engine for generating noise based images at runtime using shaders and created an importer for filters from filter forge)_ **Triangle meshes** Diving into another alternative, coming from the wonderful world of 3D graphics, triangle meshes are remarkably versatile and trivial to render on the GPU. I would assume this has been discussed a lot already so I won't cover it too much, however, a triangle mesh primitive could allow for _much_ more expressive gradients. So for example, from an author perspective, the creation process could be like so: 1. Draw a closed path 2. Click somewhere within the fill path to create a gradient node; a point combined with a colour. 3. The renderer triangulates the path combined with the gradient node(s) 4. The renderer applies the gradient node colours to the vertex colours of the triangle mesh The above could be far more intuitive than the current mesh gradient proposal as well as being trivial to implement (as under the hood it's using triangles). SVG itself could declare one of two things (or both): - A combination of a vertex array, vertex colours/ uv's plus triangle indices. Essentially a "raw" triangle mesh. - A combination of a path and a set of gradient nodes. That's enough for today I think! Please view or discuss this issue at https://github.com/w3c/svgwg/issues/257 using your GitHub account
Received on Sunday, 4 September 2016 03:11:47 UTC