1
$\begingroup$

I'm creating procedural creatures with procedural "dragon-skin" or "scales" textures (based on Voronoi texture nodes).

I want to blend multiple of these procedural textures together. However, I don't want a linear blend, instead I want the textures to end exactly where a scale of the first texture ends, so that it looks like these scales lie above the other texture.

Here's what I have so far: enter image description here

As you can see, the two textures are blended (currently I use a vertex color to influence the blending and to control how the gradient flows along the body). However, instead of blending linearly within the (dragon-)scales of the texture, I want the darker scales to be fully opaque... until some threshold, at which they are fully transparent. This will lead to a "jagged" transition line (because some scales end earlier and some end later).

My idea is to replace the current gradient with a gradient-texture that gets the Voronoi's "position" vector as input. That gives me a grayscale texture where each of the scales has a different color. However, then this color does not increase/decrease in the same direction as my original gradient (i.e. the gradient will no longer be a controlled gradient across the side of the creature's body)...

Edit: This is roughly the effect I want: enter image description here

Edit2: Here's an example .blend file:

Note that the gradient comes from a vertex attribute (vertex color) called "ring_pos". Visualizing this gradient gives you something like this ("ring_pos" encodes the position of the vertex within its "ring" of vertices, allowing me to have a different texture on the top than on the bottom. This is just a simple example, I want to add more complex patterns later, but in any case they should be encoding where I want one texture to show and where I want the other to show. There's no guarantee that these values will for a simple gradient later on.) enter image description here When sampling (as suggested in the comments) a gradient texture with the Voronoi's position, I get something that I can use as a mask: enter image description here However, this is in the wrong space, i.e. the wrong parts of the model are bright.

$\endgroup$
11
  • $\begingroup$ You should do something with UVs. Scaling UVs in one side may help. working with textures most probably fails. $\endgroup$ Commented Aug 4, 2021 at 20:51
  • $\begingroup$ You could use the 'Position' of the Voronoi to look up the value of the gradient, and mask according to whether the looked up value passes a threshold.. it depends how your gradient is generated. Is the gradient procedural, or a UV texture? $\endgroup$
    – Robin Betts
    Commented Aug 4, 2021 at 21:14
  • $\begingroup$ Hello, interesting question. I think I need an additional angle to understand the mesh. $\endgroup$ Commented Aug 4, 2021 at 21:41
  • 1
    $\begingroup$ @RobinBetts Yes, that would be perfect. However, the gradient is created procedurally and stored on the mesh as vertex colors and I don't know how to combine that with the gradient texture (the voronoi and gradient is in another, arbitrary space). Even if I had UV coords, how would that help? $\endgroup$ Commented Aug 5, 2021 at 10:58
  • 1
    $\begingroup$ @Germanunkol are you using EEVEE? We need something, given P, will return the vertex color at P. Maybe via Shader to RGB? Or, would it be OK to bake the vertex color to a UV map? $\endgroup$
    – Robin Betts
    Commented Aug 5, 2021 at 12:47

1 Answer 1

1
$\begingroup$

In principle, whatever space is being used to generate your mask or gradient, use the same space to generate the masked scales, and the mask for the masked scales.

Here, the mask is a function of Object space, (shown on the left, below.) It might have been coordinates in UV space, looking up into an image texture, whatever. So long as the same space is used to generate the scales, it can also be used by the 'Position' of a parallel Voronoi (same type, scale, randomness) to generate a per-cell mask.

enter image description here

These are the nodes for the textured example on the right..

enter image description here

$\endgroup$
3
  • $\begingroup$ If, for some reason, you can't use the same space for the gradient and the scales, you would have to be able to map one space to the other, somehow. That would depend... If I've missed the point, and that's your question, maybe share your .blend, so we can have a go. $\endgroup$
    – Robin Betts
    Commented Aug 4, 2021 at 22:19
  • $\begingroup$ Mapping between the spaces will be very hard. The sample with the gradient above is a relatively simple one (later I want the vertex colours to describe more complex features like which part of a leg something belongs to etc.) and then merge textures accordingly. I think the best way might be if I could use the Voronoi's "position" to look up the vertex colours at the vertices somehow? P.S. Thanks for the sample pictures - it's exactly what I'm going or, except for the problem with the "gradient" being in the wrong space. $\endgroup$ Commented Aug 5, 2021 at 12:10
  • 1
    $\begingroup$ Can I maybe interpolate the vertex colors into a 3D image texture (which is as large as the model) and then sample that texture using the Voronoi's position? $\endgroup$ Commented Aug 5, 2021 at 12:35

You must log in to answer this question.

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