2
$\begingroup$

Is it possible to somehow use UV islands as a factor for things in Cycles? For example, I want to use a different procedural texture on each UV island, or factor between different shaders for each UV island?

I know this is not a readily available output from any node, but is there a way to construct something like it from available nodes, even if it's not precise?

I would like to achieve an effect similar to manually rotating UVs in the UV/Image editor, but without actually changing the map. For example, consider if I had a character in a T pose whose arms and legs were unwrapped as separate islands. If I use a horizontal wave texture, it would be parallel to the arms, but perpendicular to the legs. If i wanted it parallel to the legs, I'd rotate the leg's UV island by 90 degrees. I would like to be able to do this with nodes inside a material without having to touch the UV map or create multiple UV maps.

$\endgroup$
2
$\begingroup$

Blender doesn't store anything about UV islands. Everytime you want to select a UV island, there is a code to search all the linked vertices - they are not stored in memory in a per-uv-island data structure.

As such - to answer your question - accessing UV islands from within Cycles (without using OSL shaders) is now impossible. Maybe some magic with OSL that would read vertex and UV data would work.

The least you can do is to section the UV space as @Carlo suggested, but that is not what you asked for and does not help when your UV space can't be easily sectioned.

UV data is not designed to store mask info. Use images to store masks or Vertex Colors. Using Vertex Colors has the advantage that they are not dependent on your UV island location or orientation, only on your vertex-to-UV_island mapping. Both images or vertex colors can be updated with code procedurally if your UV unwrap changes.

$\endgroup$
2
$\begingroup$

Take advantage of the island's location

Each UV island belongs to a portion of the UV space. This means that for island that have different position, you'll get different vectors. You can use this info for creating masks.

In the following example, a math node set to "less than" filter the portion of UV space that can be found between U=0->0.2 and V=0->0.2, more or less the space higlighted by the box selection.

The single UV island that can be found inside this portion corresponds to the "face" of suzanne (not head, not ears...they are outside the box), so only that part will be shown white (1), while the rest will be black (0).

enter image description here

You can use the math node output as a factor for everithing you whish (e.g. mixing two shaders, switch between different textures...).

In the provided example, for clarity's sake I preferrred to show a harsh dicotomy between the diffrence of UV islands treatment, but nothing prevent you to use smooth gradients or something else.

$\endgroup$
  • $\begingroup$ That is useful. So it selects based on the UV grid, but not specifically by island? If there were multiple islands in that area, we'd see all of them? And if an island was half in and half out, we'd only get the half inside? I have updated the question with some more info as well. $\endgroup$ – Drudge Jun 28 '16 at 7:53
  • $\begingroup$ As told by @Jerryno, there are no info around about the specific UV island. The best you can get for now is to use their location (with all the problems that this approach brings in). Yes, you'll see all the island that would fall into your filtered area and yes, you'll see only the half that is inside. $\endgroup$ – Carlo Jun 28 '16 at 19:24

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.