8
$\begingroup$

I would like to generate a polka dot pattern using material nodes. In the meantime I found this script which seems to achieve exactly what I want.

However, when I create a script node, link to the script internally and pipe the color output to a diffuse shader, my object is rendered black. Has something changed in Blender preventing this to work? Because I get no errors whatsoever.

$\endgroup$
16
$\begingroup$

OSL is nice but does not run on GPU which limits performance. The Polka pattern is not that hard to construct procedurally using nodes:

Start with a simple dot - a spherical gradient with Color Ramp:

enter image description here

With the ColorRamp you can control the size of the dot.

Next create tiling for procedural textures, but staggered. Extra is a Mapping node to control the size of the whole pattern:

enter image description here

That's it. You can also map it with Cylindrical or Spherical projection.

$\endgroup$
  • $\begingroup$ Wow, that's a great tip indeed! I was looking for something like this rather than to start scripting. Thanks. $\endgroup$ – wout Apr 14 '16 at 17:09
  • $\begingroup$ This is really cool! You might consider adapting it to blender.stackexchange.com/questions/3491/…. I didn't know about the "Gradient Texture" node when I wrote my answer there. $\endgroup$ – wchargin Apr 14 '16 at 19:31
  • $\begingroup$ (Well, to be more precise, I didn't know about the "spherical" option.) $\endgroup$ – wchargin Apr 14 '16 at 19:32
5
$\begingroup$

The shader script you linked to is written in Open Shading Language (OSL). In order to use an OSL shader in Cycles you have to check Open Shading Language under the Render rollout of the Render properties panel.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Thanks! Didn't really notice that checkbox until now. $\endgroup$ – wout Apr 14 '16 at 16:45
2
$\begingroup$

This is a special case of a previous question: Dot matrix display in Cycles?

Here is an example of the possible output:

Plane with the (old) gandalf3 logo in glowing polka dots

To create “plain” polka dots, you can

  • just use a solid color instead of an image texture;
  • use a diffuse shader instead of emission for the primary output; and/or
  • mix with a different diffuse shader instead of transparency if you want the unoccupied regions to be opaque.
$\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.