pouët.net

Low poly image effect / could this be done in realtime?

category: code [glöplog]
I'm just going to call it Dolanuay triangulation from now on.
added on the 2016-02-19 18:45:14 by kusma kusma
Oh Maali, good attempt at discouraging me from engaging on pouet, it's not like I do it often..
added on the 2016-02-19 19:06:12 by _-_-__ _-_-__
Anyway the real topic of this thread is cool
added on the 2016-02-19 19:06:40 by _-_-__ _-_-__
knos: nothing personal man :)
i like the vonoroi variant of it too btw, i assume by tweaking some math you can get it to generate triangles instead of ngons for a low poly effect... e.g. http://unitzeroone.com/labs/jfavoronoi/

btw, Boris Vonoroi was called Vonoroy in France. His father Angus Vonoroisky was of mixed Irish-Russian descent.
From Maali's post I'm thinking.

1) Detect edges with emboss filter.
2) Spray some Boris points for the edges.
3) Compute the Boris diagram using the Excess OpenGL method by rendering a 3d cone per point with z-test greater or equal.

Optionally afterwards you can apply the emboss filter again to the result since this is one of the best effects ever.
added on the 2016-02-20 19:10:18 by rloaderro rloaderro
Maali: good finding, they use some kind of flooding algo on GPU. The question is: how to transform it to triangulation (still all in GPU) ? ;) I've seen some guys doing it directly from discretized Voronoi, but it's like "meh" solution: sometimes you may have missing/crossing triangles, probably you can "hack it" until it is good enough, but it is no fun either. I wonder if there is a better way.
added on the 2016-02-21 00:12:27 by tomkh tomkh
Quote:
I'm just going to call it Dolanuay triangulation from now on.

"The spelling Delone is a straightforward transliteration from Cyrillic he often used in recent publications, while Delaunay is the French version he used in the early French and German publications. Boris Delone got his surname from his ancestor French Army officer De Launay, who was captured in Russia during Napoleon's invasion of 1812. De Launay was a nephew of the Bastille governor marquis de Launay." source

Elsewise, yes, however one might call it it is a nice and beautiful effect.
So... I've tried implementing it on GPU using two-pass JFA algo on shadertoy here. All in screen space. As I said it's kind of 'meh" solution, maybe it's possible to fix most artifacts - I don't know yet.
added on the 2016-03-02 01:48:29 by tomkh tomkh
hey that's great. How do you pick the points to tesselate?
added on the 2016-03-02 12:34:51 by Navis Navis
Navis: thx. I didn't focus on feature extraction here. So, it's just pixels that has higher luminance than surrounding pixels, sort of "corners" (code is in Buf A). I would bet some SIFT variant could give much better results, more stable over time and better following shape/sparser.
added on the 2016-03-02 13:16:20 by tomkh tomkh
Only shows a black image on AMD here. ;(
Saga: I have also black screen in Firefox. Maybe it's the same problem. I have to manually pause/start video in "Buf A" and then it works fine. Looks like some bug in shadertoy/firefox.
added on the 2016-03-02 15:35:50 by tomkh tomkh
@tomkh: Wow. This is really cool! Incredible.
added on the 2016-03-03 00:29:30 by pixtur pixtur
So you can do multipass with shadertoy? (Image A -> shader A -> Image B-> Shader B etc.)? I didn't know!
added on the 2016-03-03 10:10:50 by Navis Navis
Navis: yes, IQ did a lot of good work there lately. I like the direction ShaderToy is going, although, it will probably need full node editor at some point ;)
added on the 2016-03-03 22:00:57 by tomkh tomkh
pixtur: thanks!
I've also tried to debug / add simple interaction and it seem to have less artifacts than I thought. I would still need to do proper analysis "when it works" and "when it fails" and possibly make more formal derivation/proof.

At this point I also wonder what @smash is really doing, is he constructing triangular mesh using "compute" in-between (like most publications suggest) or also doing everything in screen space.
added on the 2016-03-03 22:35:48 by tomkh tomkh
why not on cpu? its fast enough...
added on the 2016-03-04 00:05:15 by Navis Navis
Yeah. I didn't do benchmark for a while, but CPU should be indeed fast enough, probably even for 100k, maybe even 1M points (?!). The usual problem is transferring points back and forth between CPU<->GPU, which is especially painful if you do feature extraction on GPU and/or some fancy rendering later. But honestly, you could probably do pretty fast extraction on CPU as well. It's funny how nowadays CPUs are simply underrated. I guess it is partially, because they are harder to optimize and port around (ARMv6 vs SSE/AVX).
added on the 2016-03-04 00:25:09 by tomkh tomkh
tomkh: no, i construct actual triangles and points using compute.
actual triangles and points are way cooler than screen space because you can mess with them in more interesting ways, and also add stability (as we track the points).

i really like your screenspace solution though, its very nice!
added on the 2016-03-04 13:44:01 by smash smash
Random sample points. Have them itterate a few boid- steps wrer similar colors fuse whole differences bounce off.

Create vornoy based on The remaining sample points.
added on the 2016-04-03 20:24:09 by ollj ollj
Good discussion! I used maybe the most primitive way to achieve video vectorizer featured in my last Revision's prod. Visually different from stuff you discussed here, but it got imo certain visual appeal..
Thx for theory review how to do it scientifically, this is my alchymist brute force way: check in this webapp - shape: filled triangles with some precision - should be possible to rewrite it to vertex shader to work in real-time...
added on the 2016-04-05 18:27:30 by zden zden

login