5
$\begingroup$

So recently I decided to try vector displacement. I tried to make something simple, such as this shape. It's sort of a "gun shape", but I've ran into a problem.

I wanted to make an "extrusion" downwards in a square shape. So, I made a simple square mask, using the polar coordinates formula. The first 2 groups calculate angle and distance and the third one calculates the shape.

enter image description here

Then, I added one Z mask, in order to remove the square from the top face- so it only appears on the bottom.

enter image description here

enter image description here

After inverting it, so that it's white shape on black background, I plugged it into the Z input of the combine XYZ node and then the vector went into a Vector math node, set to Add, which then goes into the vector displacement node.

enter image description here

The problem is, that in order to get the cube to be thinner(smaller on X and Z) I have to multiply it before. That causes my new shape to also be squashed on one side.

enter image description here

enter image description here

How can I have my cube to be deformed, but at the same time to have the shape follow the mask?

$\endgroup$
6
  • $\begingroup$ Cant remember exactly.. Try a separate vector displace node for each operation and vector math add them together? $\endgroup$ Feb 5 at 14:56
  • $\begingroup$ Alternative: try reversing the flow of operations that you currently have $\endgroup$ Feb 5 at 14:58
  • $\begingroup$ @AllenSimpson None of them worked, but thanks for replying $\endgroup$ Feb 6 at 12:29
  • $\begingroup$ Really need a bit more info. What vector space are you manipulating? Can we see the inputs to your tree, or maybe share the file? Also, at first sight, it seems odd to be using polar coordinates to generate a square mask? $\endgroup$ Feb 8 at 20:09
  • $\begingroup$ @RobinBetts So, Here are my answers: 1. I am using object space. 2. I am using object coordinates on the default cube. 3. To be honest, I don't really know. I wanted to generate a shape, based of a mathematical formula, and that one seemed ok, so I tried it and it worked. $\endgroup$ Feb 10 at 8:18
5
+50
$\begingroup$

I can't be sure this is your problem without seeing a bit more of your shader-tree, but..

There's a difference between Generated-space and Object-space coordinates, where render-time displacement is concerned.

  • The Generated coordinates of mesh elements are evaluated before displacement. (They measure 0-1 along the sides of the bounding-box of the (unscaled) object, irrespective of its size, oriented with the object's local axes.)
  • The Object coordinates of mesh elements are evaluated after displacement. (They are measured in Blender Units from the (unscaled) object's origin, along the object's local axes.)

Both sets of coordinates translate, rotate, and scale with their objects.

So, in this cube being displaced to a sphere, with the same 3D texture, a grid of cubic cells with thin walls:

enter image description here

On the left, the Generated coordinates are evaluated in the original state of the cube, and displace along with it, 'sticking' to the surface of the deforming object.

On the right, the Object coordinates of shading-points are evaluated after displacement, so the deforming surface 'swims' through Object space.

So, for example, if you're making masks for displacement, and want to see where they wind up on the displaced surface, it's much easier to work in Generated space. I put mine in a group that I can re-use around the tree, offset so the origin is at the center of the bounding box, and ready-separated, to avoid too many Separate XYZ 's and spaghetti:

enter image description here

$\endgroup$
2
  • $\begingroup$ This work well now, but the problem is that the mask gets distorted now. I did some multiplication to the vector that is going into the mask and it seems to do the job. But the problem is that the new shape is weirdly slanted on one of the sides. Here is and image. What could cause that? $\endgroup$ Feb 12 at 21:39
  • $\begingroup$ @TheMadTomato1209 We'd have to look at the nodes. It's hard to make the wall of a perfectly vertical (normal) extrusion.To avoid tearing, you have to allocate regions of the undisplaced mesh to the walls, and get fillets top and bottom, so enough geometry is mapped to all the surfaces. I'm sure it would be possible to make a group which automates that. $\endgroup$ Feb 13 at 7:18

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.