1
$\begingroup$

I'm struggle with vector displacement shader. I'm trying to do something like reverse cone but I can't figure out how to add radial direction. I would like to use RGB curves like screw (lathe) modifier but in shader. My actual setup: enter image description here

$\endgroup$
  • $\begingroup$ Hi, I've got it into Tangent space, but with a limitation. See edit $\endgroup$ – Robin Betts Mar 27 at 8:30
2
$\begingroup$

The strategy in this example is to generate the displaced position Q of the shading point P (in an originally planar Object space), and subtract P from Q to give the displacement vector.

The displacement is masked. If P is outside the input Radius (r2 in the tree) from object 0 , it is not displaced. A soft border has been put on the mask to prevent unsightly tearing of the surface.

Q's Z is a mapping of the mask-circle. The circumference of the circle is mapped to Z = 0, the center to Z = (Input) h. The circle is 'drawn upwards' from its center.

Q's X and Y are more easily calculated in polar coordinates. There are 2 groups in the tree, for converting between polar and Cartesian coordinates, so the mapping need only be of r, the radius of P. (Pr -> Qr)

First, Pr, the radius of the shading point, is remapped from 0->r2 to -1->1, so it uses the full range of the Vector Curves node. The result of the curve in the node is then mapped to 0-1. The result, Qr, is recombined with the original theta to get Q's X and Y, and plugged into the 3D vector Q, the displaced position of the shading point. That is then subtracted from the original shading point. The Y and Z components in the Curve node have been set to map to 0.

enter image description here

A shader-generated pawn

I'll try to get this into Blender-compatible tangent space (unfortunately, that's not standard), so it can be, say, tiled onto deformable surfaces.

EDIT:

OK, some progress, this has been shuffled into Tangent Space:

enter image description here

.. which involves working in corner-to center displaced UV coordinates, and subtracting radii, rather than entire displacement, and adding the Y -> Normal coordinate in as an absolute component.

This answer is getting long, so I won't illustrate the tree again, it's in the Blend. But there's still a problem: this does not scale elegantly. The Normal displacement (which is absolute) is not proportional to the face size (which is relative, from the UV mapping). Again, I'll try to fix this, unless you or someone else gets there first. I hope eventually we can get to a single switchable tree, which would be more generally useful, and strip this answer back.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Great! Thank you.. It is possible to convert this solution to object space (IDK if object space is right term - just in direction of surface normal) $\endgroup$ – Destrosvet Mar 26 at 10:09

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.