11
$\begingroup$

Result so far:

Final

Breakdown:

Single line:

Two Gradient textures with Constant ColorRamps added by Math node, one is rotated by 180 degrees. I can control line width by changing position of second color input in ColorRamps (they must be the same value in both).

This is wrapped in a Node Group called "Line".

Line

Triangle Fan:

Four copies of above Node Group, each of them with different Z axis rotation (0, 90, 45, -45).

triangle

Question:

It seems to be complete solution but first of all it's kind a over complicated for my taste. It's working only with Texture Coordinates > Object and controlling width and line smoothness isn't to easy.

As much as I want to ask only one question they are too dependable of each other and answering one will eliminate the need for others.

1. How to make line width control easier? (I've tried with Wave but lines are crossing after scaling.) - Partially solved thanks to @kilbee.

2. How to control line smoothness?

Smooth

Blend file:

Edit 1:

Thanks to @kilbee I have managed to pack node setup and control width but I have lost ability to smooth lines. I was wrong saying that one question will solve the other one:)

killbee

Blend file with @killbee setup:

I have also edited question a little bit to be more specific.

Edit 2:

@kilbee has done it. Amazing. Here is his version packed in Node Groups with little modifications (just Multiply nodes as Values):

$\endgroup$
  • $\begingroup$ Interesting question. I might be able to simplify some parts of the node tree, maybe, but can't look into it right now. If no one beats me to it I'll try and see what I can do later tonight $\endgroup$ – Duarte Farrajota Ramos May 2 '17 at 18:54
  • $\begingroup$ @DuarteFarrajotaRamos kilbee partially solved it, but I have lost control over line smoothness, so I'm waiting for your approach impatiently :) $\endgroup$ – cgslav May 2 '17 at 19:50
  • $\begingroup$ My answer was also going to use a Math node set to Greater than too, so not sure I can add a lot more input to this. Hum let me see $\endgroup$ – Duarte Farrajota Ramos May 2 '17 at 22:00
  • 1
    $\begingroup$ @DuarteFarrajotaRamos kilbee has done it. Control over width and smoothness. I need to work a little over smoothness values as they behave a little bit off. Too much influance at low values and very little before fully hard edge. $\endgroup$ – cgslav May 2 '17 at 23:26
9
$\begingroup$

I don't know if you'd find it easier, but I often use split vector values for this and (greater/less than) math node:

enter image description here

As you can see, this way you can easily control position on the object. Creating a line from this is simply a matter of offsetting the value in both directions and adding the results: enter image description here

enter image description here

You can easily make it more compact, but I'll leave it as simple as possible to experiment with.

EDIT: Well ok then, I'd use gradient texture indeed and then just apply different formulas for color interpolation or/and scale the texture coordinates. If you think about Gradient texture (Linear), it's actually a simple interpolation between black and white (0 to 1). Using right mathematical formula should give you any interpolation you want. So I'd approach this first by scaling the mapping vector from Object output (multiplying by value higher than 1 would squash the values inside, while using values between 0 and 1 would extend the interpolation beyond the object). So, if you think about that, you could say that with default values you have a soft line of the width of your object: enter image description here

The 'greater than' node explains it enough, I hope: enter image description here

So to control the interpolation - the first thing that comes to my mind would be use power math node: enter image description here

Then simply scale the mapping vector: enter image description here

Simply multiplying vector values inside that group: enter image description here

If you'd like to shift the lines, you just add a value to each axis, just like I did multiplying there. If you experiment with different math formulas and Gradient texture interpolations (Quadratic, Ease) i think you will find the best way to control the line smoothness this way:

enter image description here

EDIT2: To debug transition you can literally draw it like a function: use Displacement Input for your Material Output (in this example I used simple box scaled in Z to 0.01, with adaptive subdivision). This is how values for Quadratic interpolation look like originally: enter image description here

...and powered by 2: enter image description here

$\endgroup$
  • $\begingroup$ Interesting approach. I'm always amazed how you mix them Math nodes to get such results :) Check my edit please. This is really great answer (have an upvote for this) but did not solve my problem completely. I've mentioned about smoothness in Question section but didn't refer to it in actual questions. Sorry about that. Blur node would be savior here. $\endgroup$ – cgslav May 2 '17 at 19:47
  • $\begingroup$ Ok, updated answer. You were definitely on the right track there. $\endgroup$ – kilbee May 2 '17 at 22:24
  • $\begingroup$ Amazing! I hope this answer will be upvoted a lot more. You can check my second edit with everything packed in one Node Group. I need to work on Smoothness control as it is working strange - most infulance is with low values. Or maybe this is the way it should be :) $\endgroup$ – cgslav May 2 '17 at 23:15
  • $\begingroup$ Check second edit I made, this should help you debug your smoothing. $\endgroup$ – kilbee May 3 '17 at 18:35
4
$\begingroup$

A solution which can be animated:

enter image description here

The principle:

  • From generated coordinates we have co between 0 and 1
  • Shift and scale it to have each co between -1 and 1
  • Calculate the angle in 0-2xPI of this co (around z)
  • Calculate the slice size angle (2xPI / slice amount)
  • Calculate the rounded angle of the co (corresponds to the slice position)
  • Rotate the coordinate with this rounded angle
  • The Y value of this rotated co is the distance to the slice

That allows to introduce some variations.

For instance:

enter image description here

Or:

enter image description here

Falloff/gradient:

enter image description here

The main node is the following:

enter image description here

Inputs:

  • Vector coordinates (typically generated)
  • Amount of slices
  • A size notion (resulting size will be a mix between this input and the amount of slices)

Outputs:

  • Value the distance from the slice tuned by amount of slices and size
  • XCorrected and YCorrected: rotated coordinates of the co along X axis
  • XNormalized and YNormalized: normalized vector around a sphere corresponding to the co
  • XCentered, YCentered: centered coordinates (between -1 and 1)
  • Angle: the angle of the co (between 0 and 2xPI)
  • RoundedAngle: the rounded value corresponding to the slice

$\endgroup$
3
$\begingroup$

As an alternative to @kilbee's excellent answer, you could manipulate the Object coordinates directly (rather than using Gradient Textures) :

using maths

Here the Absolute mirrors around the centre, the Multiply value can be used to adjust the scaling (line width) and the Power node adjusted to affect the 'hardness' of the line (eg, 50 would be a very hard edge, lower values would be softer). Note that the Power node has 'Clamp' set to ensure the resulting value is clipped to between 0.0 and 1.0.

Combined, value nodes can be used to drive each of the variables (scale and hardness) and the result multiplied together.

combined

For ease of manipulation of the transition you could replace the Power node with a Color Ramp :

using color ramp

Again, use the Multiply node to scale the overall effect. Adjust the Color Ramp to affect the transition, adding/moving color points or changing the Interpolation (Constant, Linear, Ease, B-Spline, etc.) as desired.

A further method is to use an RGB Curves node by adjusting the 'Combined' channel (the 'C' rather than 'R', 'G' or 'B'). This provides full visual control of the profile of the transition.

RGB Curves

$\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.