2
$\begingroup$

I'm trying to stretch a noise texture along a curve. Normally, my basic normal texture displacement is as follows:

enter image description here

enter image description here

Say I want the noise to stretch along the x axis. Easy enough. Just multiply the noise mapping vector. enter image description here

But say I now want to modify the curve to point not in the global x direction. How can I stretch the texture along the curve tangent, rather than global space? I realize I could add noise to the curve circle profile, but I don't want a completely constant cross section. enter image description here

My vector math skills are rusty! Thanks!

$\endgroup$
1
  • $\begingroup$ Lovely. This is brilliant. You are an accidental genius. Imagine if the above were grease pencil, your attempt to make jaggy lines. I can see many uses for your node work above. $\endgroup$ Dec 20, 2023 at 8:58

2 Answers 2

4
$\begingroup$

We want to map the texture as if the curve was straight along X.

enter image description here

The black line is the curve.

The plane is a little part of the bevelled curve and the green dot is a point of it.

The blue dot is the curve point that originated the green point.

We want X axis along the curve tangent. Y axis along its normal. Z axis along its binormal (the cross product of the tangent and the normal).

If we want to know X, Y and Z components of the green point in this coordinates system, we'll need to know:

  • Blue point position
  • X position along the curve
  • The normal
  • And the binormal

(is there a more simple way?)

So we capture these four information above before converting the curve to a mesh.

enter image description here

Once done, we use them to recalculate the coordinates for each point of the resulting surface.

The dot products retrieve the part of the green point position relatively to the blue point, respectively along Y (normal) and Z (binormal):

enter image description here

I've used a checker texture instead of the noise in order to have a better view of the results:

enter image description here

(Blender V4.0)

$\endgroup$
1
  • $\begingroup$ Awesome, thanks for the vector explanations!! I Tried using cross product of normal and curve tangent to get the binormal as that felt natural, but wasn't using capture attributes. Thanks! $\endgroup$
    – Erik
    Dec 20, 2023 at 17:50
3
$\begingroup$

You can use UV coordinates for the noise, with the simplest implementation of the UV not giving you a clean seam, but an interpolation across the one face loop near the seam, which is desirable in this case:

I positioned the camera to show the UV seam, which is rather sharp because of the somewhat high resolution of the Profile Curve, and yet the GIF shows you don't really see the seam in the topology - there are other artifacts nearby because the mesh folds onto itself due to too strong displacement of too rough noise:

However what if you stretch along the Profile Curve rather than the main Curve?

Now the discontinuity becomes clear. However, we have 4 dimensions available in our noise, and are only using two, so we can fix that by adding a dimension:

Don't look for a seam, there is none:

Homework

What if the main curve is cyclic? Can you use a 4D noise to get rid of the seam?

$\endgroup$
2
  • $\begingroup$ So you mapped the entire curve surface onto a 2D plane, where (0,0) is the start of the curve profile and start of the main curve, and (1,1) is the end of the curve profile and end of the main curve. In the second example, you used the X,Y position of the curve along with the Z component, which is the spline parameter (0-1). And then used 3D noise. For a cyclic curve... you could instead use the W parameter instead of the input vector, as each point along the curve could map to a different phase. You could make this symmetric with some kind of float curve? I'll work on this... $\endgroup$
    – Erik
    Dec 20, 2023 at 17:46
  • $\begingroup$ @Erik for 4D do the same for the main curve as I did for the profile curve for 3D. Then you end up with one curve XY, and other curve XY, totalling 4 dimensions. $\endgroup$ Dec 20, 2023 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .