10
$\begingroup$

I'm trying to create a polygonal art background, based on an image texture, like this penguin picture at this link: http://www.polygenapp.com/ That image was generated using this method, How can I do something like it using cycles. Note, I already have a mesh, I just want to texture it.

Ideally I prefer OSL, but anything that is one or two click to update will fly.

The method works by finding the color at the center of the face. I believe the is better then averaging vertexes in many instances.

Note: It would mean a lot if I didn't have to apply any modifiers on the mesh in order for this to work, just heads up.

Here is a practice file with modifiers:

This is not a duplicate of this: Is there a smart way to apply a better transition between colours while maintaining one solid colour per face?, That is not applicable to any textures, just gradients.

$\endgroup$
9
  • $\begingroup$ so do you have the mesh , or you want everything to get generated from a texture image $\endgroup$
    – Chebhou
    Apr 26, 2015 at 13:28
  • $\begingroup$ I've got a mesh, how would OSL generate one $\endgroup$ Apr 26, 2015 at 13:30
  • $\begingroup$ not osl , python $\endgroup$
    – Chebhou
    Apr 26, 2015 at 13:33
  • $\begingroup$ @Chebhou OSL might be able to, which would be really cool $\endgroup$ Apr 26, 2015 at 13:36
  • $\begingroup$ I've got close result using the previous answer but I think even with osl you'll have to edit the mesh to match the color transition $\endgroup$
    – Chebhou
    Apr 26, 2015 at 13:53

2 Answers 2

15
$\begingroup$

Here is one way to do this :

  • duplicate the final mesh (modifiers applied )
  • UV unwrap the new object using this method :

    • select all face
    • hit Ctrl+E and select Edges Split
    • resize all faces to Zero with Individual origins as a pivot
    • U and select Project from View Bounds

enter image description here

  • copy this map to the original object, using CtrlL>Transfer UV map

After that all points on the same face will have the same UV coordinates meaning they will have the same color in render.
You can adjust the UVmap for more precise output.


For the workflow of setting up a good mesh :

  • Add the Image as a background in the view
  • Add a plane (or simply import the same image as plane to skip setting up materials)
  • Delete the face (in Edit mode Select All and X and select Only Faces)
  • Start doing a loose tracing of the image by adding vertices in Edit mode (Ctrl+LMB, don't worry about crossing edges!)

enter image description here

  • Delete all edges (Select All and X and select Only Edges&Faces)
  • For this step you need the Delaunay/voronoi Addon it will create a triangulated mesh from the points

enter image description here

  • The rest is described in the first part above

And here is a sweet penguin render :

enter image description here

$\endgroup$
6
  • $\begingroup$ Not quite as elegant as I was hoping for, but still usable, and quite ingenious $\endgroup$ Apr 26, 2015 at 16:01
  • $\begingroup$ Very nice solution! $\endgroup$
    – Denis
    Apr 26, 2015 at 16:02
  • $\begingroup$ @Chebhou How to you copy the UVmap? $\endgroup$ Apr 26, 2015 at 16:25
  • 2
    $\begingroup$ @GiantCowFilms Ctrl+L and transfer UV Maps, you need to create a new UV Map and make it active first, then you can transfer from active object $\endgroup$
    – Denis
    Apr 26, 2015 at 16:34
  • 1
    $\begingroup$ @Chebhou Thanks so much for this trick! Didn't know such cool UV transfer to Polygon color :D $\endgroup$ Aug 25, 2016 at 0:41
0
$\begingroup$

If you duplicate your mesh, split your faces by edges, unwrap and scale it all to 0 with individual origins option, you gonna have a uvmap that you can use on your original mesh. But since the geometry nodes exist, we can transfer the uv to vertex color and use it for the mapping.

First you need to go 'Object data' >> 'Vertex colors' and create a vertex color layer.

In older versions from 3.0 you need to have two 'Attribute convert' nodes. The first is to get the uvmap and write it to a temporary variable. It's gotta be in face corner domain and the type is color. Type 'UVMap' to the first attribute and any string to the next. Second node is to get the temporary variable and write it to vertex color data. So type your attribute name to the first and select the vertex color layer below on the 'Result'. Now you can simply create a vertex color input and tie it to vector input of your texture node in the 'Shader editor'.

In 3.0, again first go and have a vertex color layer created. Add a 'Transfer attribute' node, give it the target and connect the attribute socket to 'Group input'. Now you created an attribute so press N, go to 'Group' tab, find your attribute and change the type to 'Color'. Also find the attribute on the geometry node modifier from the modifier stack and pick the uvmap as the value. Duplicate the 'Transfer attribute' node, change the type to 'Color', connect the same target and the attribute output you just did. Now link the new attribute output to the 'Group output' so you have this new attribute that you need to change its type to 'Color' and domain type to 'Face' from N >> 'Group' >> 'Outputs'. After you do all this right and pick the vertex color name as the output attribute from the modifier stack you should be able to use the vertex color layer as vector input for the mapping on your shader setup. Using the vertex color node as a vector input is not working outside cycles anymore so go to add node >> Input >> Attribute >> type the vertex color layer name and connect the vector socket to your texture.

All in the screenshot:

vertexcolortouv

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .