2
$\begingroup$

I am wondering how the mapping node exactly works. The only thing I need to know, is what the individual Location, Rotation and Scale vectors, especially the Location vector, do to the input vector. Does changing the Location vector simply add onto the input vector or is there a more complex approach behind it? I'm interested in remaking the Mapping node as a part of a shader, which is not related to Blender and I'm not quite sure about that. I couldn't really answer my question with the posts I found in the internet.

Thank you very much

$\endgroup$
3
$\begingroup$

Location does indeed just add to the vector-- using a mapping node that maps location is no different than using a vector math/add node. Scaling just multiplies the vector's components. Rotation of 2D coordinates moves your x,y to length * cos (thetaInitial+thetaMapping), length * sin (thetaInitial+thetaMapping). The only thing that's remotely complicated is the order of those operations-- but then, you can always specify order by doing sequential mappings.

But really, what it's doing is creating a transformation matrix and then multiplying your vectors' positions by that matrix: https://en.wikipedia.org/wiki/Transformation_matrix . The matrix multiplication explains the math behind 3D rotations and the order of operations.

If you're recreating the effect for a shader in, say, Unity, you can just add values to your UV (for example), there's nothing wrong with that. But there's a lot of value in having at least some understanding of transformation matrices, for writing shaders and for understanding 3D graphics in general.

$\endgroup$
1
  • $\begingroup$ Sure, of course. I definitely understand what's going on there. I just wanted to make sure how Blender handles this. Thank you very much for your answer! $\endgroup$ – User Feb 19 at 15:06

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.