2
$\begingroup$

I have this fish-shaped pastry with a gradient texture which makes it brown around the details. However, I can only get the gradient on the top side of the fish, and I'd like it on the bottom side of the fish too. Is it possible to mirror the gradient effect? Thanks!

enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ Yes, but the details depend on the kind of coordinates you're sending the gradient texture. We need to see the nodes. $\endgroup$
    – Nathan
    Feb 14 at 20:00
  • $\begingroup$ @Nathan Sorry, forgot to add that! I've included it now, hopefully you can see it ok! :) $\endgroup$ Feb 14 at 20:03
2
$\begingroup$

Mirroring is a pretty simple operation-- you just take the absolute value of your coordinates-- but any transformations like this occur about the "0" point of the coordinate system.

For generated coordinates, the center of your coordinate system is at the lower, left, front corner of your object's bounding box. If you just mirror about the generated texture origin, you'll only be affecting samples outside the bounding box-- it won't affect the visible model! Likely, the point across which you want to mirror the gradient is the midpoint of your model, which is located at 0.5,0.5,0.5 in the generated texture coordinate space.

But you can change the origin point of transformations like this by moving the texture coordinates, applying the transformation, and then moving the coordinates back, like on the middle Suzanne:

enter image description here

Notice where it leaves the mirror line: in the middle of the gradient. This can be addressed, if desired, by changing our mapping, such that we're mapping the center of the model to 0 and the outer edge of the bounding box to 1, as with the third Suzanne.

Similar techniques--translate, transform, untranslate-- can also be used to rotate or scale about different origins.

$\endgroup$
1
  • $\begingroup$ That worked great! Tbh it was a bit confusing, but after I messed with it a tiny bit, it worked perfectly! Thank you! :) $\endgroup$ Feb 14 at 21:26

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.