My question is very similar to this one, but the answers there don't capture the essence of the problem imo. Assume you have beveled paths in Blender, then every location on the path has a tangent vector that points in the direction of the path.

In the coordinate system of the camera, assuming the z-axis is our viewing direction, we are only interested in the x-y-portion of the tangential vectors. What you want to achieve is that path-parts that go into the same x-y-direction have the same coloring. This also means that a vector that points into the opposite direction another vector, will get the same color.

For people working with visualizations of vector fields, this is nothing new and besides coloring the magnitude of the vectors, one major application. A good test-case is a ring viewed from above because it contains all directions and one can easily check the correct coloring. I came up with the following solution in Blender 2.81

enter image description here

This is a simple nurbs-circle. I used the Geometry node to get the tangent vector and after converting the coordinate system, one can calculate the direction using trigonometry. I have 3 questions, but the first one is the major problem I'm trying to understand:

  1. In the small rendered view, one sees that on the blue and red spots, it almost looks as if the coloring changes too fast. It doesn't look so severe in the preview but I have the feeling that the color between blue and red on the left side takes a too large portion. Did I do something wrong or is there a reason for that?
  2. Is there a simpler node-structure that achieves the same?
  3. Is it a bug that the "Hue Saturation Value" doesn't work if the second color doesn't have the saturation set to max?
  • 1
    $\begingroup$ Your additional question link is an Skype invitation, is that normal? $\endgroup$ – Hikariztw Dec 8 '19 at 0:39
  • 1
    $\begingroup$ Good lord.. thanks for pointing this out. I fixed it. $\endgroup$ – halirutan Dec 8 '19 at 2:04
  • $\begingroup$ HSV is non-linear, you're right. But another question: if you're only interested in 2 dimensions, why are you encoding in 3? Wouldn't RG do, without B? $\endgroup$ – Robin Betts Dec 8 '19 at 9:39
  • 1
    $\begingroup$ There are many different ways to do this, but using the Hue value is often used in science. Here, I just wanted to see how to turn the tangent direction into color with Blender. To get beautiful color gradients out of this, one could take the tangent-direction t and use an appropriate parametric function {fx(t), fy(t), fz(t)} and use this as coordinates in XYZ-color-space. Then you can get whatever color gradient you want, and colors will have perceptually the same distance. I'll try this later. $\endgroup$ – halirutan Dec 8 '19 at 15:20

That's a beautiful node setting. I will try to explain some problem first:

  • You shouldn't use emission shader for your output, if the output is Color and you want that color directly show on your screen, please directly connect the Color socket to Output Surface socket.
    This post elaborated more detail of color output setting

  • What you mean too fast? Human color perception is complicated, we try a lot, a lot of method to describe and organize color: sRGB, Adobe RGB, NTSC, CMYK or even Pantone®. Blender using sRGB as default output color and if my memory is correct, purple will be strongly receive for our eye in normal sRGB situation, Blender is using this solution as standard.

enter image description here

Back to your question:

  1. Change the color management in properties panel, View Transform: Raw

  2. Not sure, emission is useless in your situation, and the final subtract node can be done by changing the HSV node color

  3. Directly connect the color to the output surface socket should fix the problem. Emission is not final color output for Cycle and EEVEE.

  • $\begingroup$ BTW the node itself is pretty simple in my opinion. All is math calculation, Computer should love these nodes. $\endgroup$ – Hikariztw Dec 8 '19 at 0:29
  • $\begingroup$ Thank you for this answer. As a on-off user of Blender (just when I need something to render), I didn't know that I can go without a shader. Also, your colored ring looks exactly how I want it. Just compare how much larger the pure red transition is compared to mine. It was really hard to describe what I meant by "certain colors change too fast". Let me look carefully into the information you provided. Thanks again. $\endgroup$ – halirutan Dec 8 '19 at 2:10

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.