8
$\begingroup$

I just saw this on codegolf and thought it would be an increadibly cool application of the Blender compositor for NPR. Perhaps coupled with a blur shader this could make a nice painterly effect. Is there any way of creating a Voronoi map effect in the compositor?

This is the effect (from the codegolf topic above):

Voronoi of Saturn

$\endgroup$
  • $\begingroup$ What does Bl.SE mean in your question above? Blender has Voronoi texture. $\endgroup$ – atomicbezierslinger May 19 '15 at 6:35
  • $\begingroup$ Are you looking for this effect, or does it specfically have to be in the compositor where everything takes place. I wrote a script that generates a VertexColor map given an input photo and a polygon-mesh (could be voronoi based) to put the colours into blenderpython.tumblr.com/post/117154100009 $\endgroup$ – zeffii May 19 '15 at 6:43
  • $\begingroup$ @zeffii No, I'm looking for this specific effect. The codegolf I linked to has examples so I could do this as post processing outside of blender but that would not be ideal. $\endgroup$ – Amziraro May 19 '15 at 6:49
  • 1
    $\begingroup$ @atomicbezierslinger Yes Bl.SE is blender.stackexchange, Blender has a Voronoi texture but that is not what I'm looking for, see the codegolf link. $\endgroup$ – Amziraro May 19 '15 at 6:52
  • $\begingroup$ I tried a few things with Cycles material nodes and I just can't seem to manipulate the vector the right way. Sorry, looks like you can't do this within Blender without coding some kind of script yourself. $\endgroup$ – Johnson Martin May 19 '15 at 23:16
4
$\begingroup$

Bingo.

  1. There's a Voronoi Texture that has been scaled to match the aspect ratio of the output image
  2. The coloring of the Voronoi texture is set to Position
  3. The color information from the image is recombined with the color information from the voronoi texture using a UV map. UV interprets colors as coordinates where red=x green=y blue=z
  4. Two more ramp textures calm the randomness of the voronoi texture's positioning down. Unfortunately, the "position" coloring of the Voronoi texture isn't based on true position, but rather is totally random. If it were based on true position, then we wouldn't need the baseline ramp textures at all. (time to make a feature request!)

voronoi filter

This is about as close as one could get, I think. The scale of the voronoi texture could maybe be controlled by the image if you ran some filtering to find edges. (which just requires placing the source image ontop of itself with "difference" mixing, and shifting the upper image by a pixel or two on both X and Y)

| improve this answer | |
$\endgroup$
  • $\begingroup$ +1 That is what I was looking for. Also probably the most awesome/beautiful abuse/creative use of how blender handles UVs. Would you mind sharing the exact RGB start/stop values for the color ramps? $\endgroup$ – Amziraro May 29 '15 at 16:19
  • $\begingroup$ The ramps are pure blue to pure magenta, and pure blue to pure cyan. positions 0 to 1, linearly. Think of them like a "red ramp" and a "green ramp" except you need blue to be 1.0 at all points because it controls "Z" which becomes the alpha. $\endgroup$ – Wray Bowling May 29 '15 at 17:48
4
$\begingroup$

There are multiple things happening in the algorithms presented in the link you shared, but the most important thing that's happening is not possible in Blender's compositor.

  • Converting an image into a fixed of points
  • transfering that set of points as a parameter into a hypothetical "voronoi" node. There is no such data type
  • using a vornoi algorithm to fill in polygons with sampled colors from a set of points

Now, in theory you could reduce that set of instructions into just one step

  • a python compositor node

but to do that is no small chore

There are plenty of clues in the codegolf post on how to process the image, how to find edges, how to make that bitmap into a set of points, how to process the points into polygons, and how to fill them.

I'd like to offer up the code for a python compositor node that just does all that for you, but it would just take a terrible amount of time. An onerous amount of time. Enough time that the short answer to your question is "no."


On the other hand! If you're also interested in exploring the general effect and breaking out of the compositor-node-constraint, there are other things you could explore. (in your comments, it seems you're only interested in voronoi specifically, but i'll try anyway)

Here's an image that was made with a "lens" made from a box, one side heavily subdivided, displaced with a cloud texture, and then decimated. The lens is using a glass texture with 0.02 roughness to generalize the colors coming through each face. If the displace filter was made to transpose over time, the facets would change and shimmer.

While it's not exactly what you asked for, in my opinion, it falls into the non-photo-realistic category. I think you could go quite far with it -- especially with render layers feeding into the compositor.

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ this is a nice idea $\endgroup$ – Chebhou May 28 '15 at 18:46
  • 1
    $\begingroup$ about the compositor python nodes do you have any ( even simplest ) working example that respond to composting ? I would be highly interested $\endgroup$ – Chebhou May 28 '15 at 18:49
  • $\begingroup$ I would also be interested in python nodes that work in the compositor, perhaps i (or someone else) should ask a question... $\endgroup$ – Amziraro May 29 '15 at 8:27
  • $\begingroup$ I spent a few hours trying to figure it out so I could feel like I knew what I was talking about while writing this answer. There are templates for python nodes that comes with Blender. Text Editor -> Templates > Python > Custom Nodes. That's as close as I got. $\endgroup$ – Wray Bowling May 29 '15 at 14:17
3
$\begingroup$

Create an image pane with the image you want to distort. Place a new plane between the image and the camera and add a glass texture to it.

enter image description here

Subdivide the glass plane and apply a displace modifier that uses the voronoi texture.

enter image description here

enter image description here

By changing the parameters on the texture you can get to the results you're after.

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.