The UV Torture Thread (Cycles)

The rules of the game are simple.

Take a Texture Coordinates node and an Image Texture node, plug a black box (a node group) on the line in between the two of them. Put as many nodes of any kind as you want in the black box and modify the coordinates “on the fly”.

The result doesn’t need to be useful, just interesting. Post a picture of the result and explain what’s happening in the black box… more or less.

Anything else is allowed (within the limits of the rules of the forums)… especially bragging. :wink:

As my first entry in the thread, here is something I made to answer a post in a forum: Polar projection. The OP didn’t show up to pick up the work or to say thanks, so I had plenty of time to perfect it. The OP didn’t really explain what he/she wanted to do with it and I still haven’t found any use to it either but I made something of it.

Don’t ask too many explanations about what’s in the black box…

(With one of the textures in the bottom right corner.)

One of my multiple personalities is obviously a mathematician but he didn’t stay “online” long enough to explain. :wink: Somebody in the original thread suggested me to study the part of the source code of the GiMP dedicated to the polar projection. I was really surprised to find a formula which looked much like something “my” mathematician cooked up. tl;dr. I re-checked what I had and fixed the last glitch. Now, it’s perfect… altho I use a roll of duct tape. :wink:

Here again something that I got from the “Lost and Found Answers” department: A 4-digit counter very easy to handle.

This one, I love it. There is just one value to change to control the display which can be a single face or several faces spread across several objects like in my image. Changing the style of the display is also easy: Any texture with the 10 digits can do.

(The texture I used has lit and unlit dots on a transparent background, shown in red here.)

I can’t really show the content of the black box which is full of nested node groups up to 3 levels deep but I can explain. The UV map is made so that the material should display the whole texture. Cycles provides the UV coordinates, I cut them in 4 quarters along the X axis (U) for the 4 digits and I re-map them so that, at this point, Cycles would display 4 times the first quarter of the texture across the whole material. During that time, another node group takes care of chopping the value of the display in 4 single digits so, for each quarter, I can calculate the offset to display the right digit. A bit of scaling to widen the digit to fill its quarter and that’s it. It just works. :smiley:

In pseudo-code:

if U < 0.25:        # First quarter (0, 0.25)
    X = U           # No change.
else if U < 0.5:    # Second quarter (0.25, 0.50)
    X = U - 0.25
else if U < 0.75:   # Third quarter (0.50, 0.75)
    X = U - 0.5
else:               # Fourth quarter (0.75, 1.00)
    X = U - 0.75
X = X / 2.5         # Scaling
#                   # + Offset
if U < 0.25:        
    X = X + (digit[0] * 0.1)    # First digit
else if U < 0.5:
    X = X + (digit[1] * 0.1)    # Second digit
else if U < 0.75:
    X = X + (digit[2] * 0.1)    # Third digit
    X = X + (digit[3] * 0.1)    # fourth digit
U = X   # Output socket

I wouldn’t call this programming, it’s just pure logic. The only problem is that Cycles has no IF/THEN/ELSE node. Well, that’s easy to do. The hard part was to split the display value into digits because Cycles works only with floats while all I needed was integer digits. The noodles really deserve their nickname, I made a plate of spaghettis in my node tree. :smiley:

Cart2Polar works nicely - I’m able to map square UVs into a “disk”, without UV tricks or unnecessary geometry. It might have been me you refer to, I just kinda wrote it off as impossible and forgot about the thread, after not explaining too well exactly what I was looking for :slight_smile: What can it be used for? Think (end grain) lathing/cutting grooves on a simple non circular surface, or a fresnel lens. Try vector curves on its output; X controls the radial speed of change, Y (mapped as a “perfect” sawtooth) creates the basis for a non repeating seamless overlap if hooked onto noise, with instant feedback for tweaking. This creates the radial grooves. Another output is ramped just up and down and can be used to drive anisotropic direction. If Z is a different copy of Y and they are added together, it can also be animated - but it will show a direction change to be seamlessly animated. In order to get rid of the apparent direction change, we’d need to have access to 4D noise where we can plugin anything to the 4th parameter. Iirc from the last time I did this, it’s been many years :slight_smile: I also used cart2polar (and back?) on a gas planet material I made in other software long time ago - where “local storms in the bands” come and go while rotating across the surface.

I’m guessing I just have to play with the numbers to make it tile only once? But it’s way past my bedtime so I don’t have time to play around with it just yet :slight_smile: But thanks again, this is awesome stuff.

@CarlG: Let’s say that it wasn’t you. :wink:

As for playing with the numbers… Good luck! I exploded my head on the keyboard several times before to break everything… in the node tree. I needed a lot of coffee to wake up “my” mathematician but we (me and I) managed to remove the tiling. :wink:


Of course, here is the blend file: Wrap Polar.blend (302 KB)

Enjoy! :smiley:

Today, I broke a picture. You should try, it feel so good. :wink:

The black box sums up some crazy ideas I caught because I read too many posts in the forums.

What happens in here is that I take each little piece from a Voronoi texture and I replace it with a random and rotated part of another image. The other way around, in other words, I add the color of the Voronoi cell to the rotated UV. I also use the greyscale value of the same Voronoi cell as angle of rotation (multiplied by 2*PI).

If you wonder why I subtract the vector (scale, scale, scale) from the UV coordinates of the Voronoi, that’s because I was thinking of using this broken image material in an animation. The problem with Voronoi is that it grows from the corner when the scale increases. It doesn’t with my trick. The result is totally wrong… but in an interesting way. :wink:

Lolwut? I’m certainly glad I didn’t try “experimenting” my way to get to that. Holy hell! I think there may be a mistake though, at least when plugged into my test setup: Plugging R and G into emission shaders, the R one (radial angle) seemed blown out of range. If I change the last operator in Signed Angle from Add to Subtract, I’m at least given a 0-1 output range. Haven’t checked direction, but that is of less importance to my current test. Not sure, could be my own additions. But great stuff anyways.

This one is perfect for any LSD-based modeling you might be doing. And dadaist’s will probably like it. As usual, I have no idea what any of the nodes do; the red ones probably mean I’ve broken some rule. The only real use I could think of is making wild reflections.

I’m guessing the node tree bunched together like that with no regard to placement and organization makes it more cryptic than it looks.

As for Kaluura’s disk mapping, it’s quite a clever combination of trigonometry functions and basic operations (through the math nodes), I never would’ve thought of doing that through the node system.

As for the broken image, I think I can easily grasp how that was done as I have made a group node in the past that displaces a texture’s position based on another texture, all this really does show what you can do when you take advantage of the fact that the vector data can be split into the individual channels for complex alterations.

Too bad there is not a “selector” node, where based on an input value you can switch between several vector values. Is writing OSL nodes yourself allowed?

@Jonim8or: Tsk tsk tsk! OSL isn’t allowed. Too easy…

As for a selector node, it’s totally possible. I made an IF/THEN/ELSE node for values.

All that is needed is to replace the multiplication and addition by vector math. Only a vector * constant node needs to be made since Blender doesn’t provide it. (Maybe a Color Mix set to multiply can do it? Must check…) That’s a switch already. If you chain the IF/THEN/ELSE nodes, you can select by range.

Taken from my 4-digit display node tree. In pseudo-code:

if U < 0.25:
    value = Digit1
else if U < 0.5:
    value = Digit2
else if U < 0.75:
    value = Digit3
    value = Digit4

Easy as pie… :wink:

@BlenderAllDay: Interesting result… But you’re disqualified because you can’t explain. :stuck_out_tongue:

As for the red noodles, that’s because you made loops with your connections. Blender doesn’t like that. :no: You’re making it run in circles. :smiley:

for group node where did you change the name of inputs on the left for the ifthenelse group?

you are becoming a cycles math wizard !

did you ask cycles dev to add a new ifthenelse a new math node feature?


@RickyBlender: To change the name of the sockets of a node group, you must open the Properties shelf, a.k.a. the [N] panel of the Node Editor. You’ll find the Interface panel to do all that we used to do on the sides of node groups… plus setting limits.

And, no, I didn’t ask to anybody to add anything to Blender. Besides the fact that there is no official channel, there is a persistent rumor saying that the devs accept no suggestion. :no: Any way, that would be much less fun if the nodes weren’t so constraining. :wink: It forces you to think…

just found it
never really tried it before
dont’ like to change names cause it makes it more difficult to find things like what is the original node for that node

hope we get a lot more nodes with GSOC project this summer that will help to get other effects with cycles!


But if you want to share it with other people, then giving custom names to the inputs and outputs of the group nodes are critical.

Nothing would be more confusing than a large group node with a dozen inputs all saying ‘fac’. Even you would eventually have trouble finding out what does which unless you open it up to look at the tree every time you use it.

agreed for group nodes it is usefull to give proper meaningfull input and output names
but not really for nodes inside the groups

let’s hope we see much more new nodes with GSOC project
will be interesting to see what we get this summer!

happy cycles

I’m a cat, I love to watch the wash machine spin. :wink:

Look at in action: Hypnotic! :smiley:

If you look closely in HD, you should even see the Moiré effect.

For this one, the black box contains the formula for the rotation of a vector around a point (in 2D only).

And what I do before is to calculate the distance in between the UV point and the center of rotation. Multiplied by 2*PI, that’s the angle of rotation. It already starts to turn into a spiral. The “Rotation Factor” increases even more the angle of rotation and makes the spiral narrower. In the video, for example, I animated the “Rotation Factor” to go from -100 to 100 while the center moves from one corner to the other.

Working on it gave me some interesting ideas… for the next time. :eyebrowlift:

Almost a failure… Well, there is just a little something which doesn’t work in my tree. I’ll fix it another time. Any way…

Fully animatable lense effect. Center, radius… but not power… yet.

I haven’t reached the level of horror I saw once but my node tree should give some nightmares to the newbies in Cycles. :smiley:

4-level deep node group nesting. I’m starting to wonder if there is a limit… :wink:

Poor kitty… ;).
Out of sheer interest - what was that horror tree you mention?
Sometimes i’m amazed what jungles one has to get through to get simple things done…That IF-THEN-ELSE is a great example as is mapping node itself.
Anyhow, thanks for sharing!