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!
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:
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.