Texture transformation confusion (position, scale, angle)

I am just not getting my head wrapped around how to manipulate textures. I grasp that there are ways to manipulate it (uOffset, uScale, uAng and the v and w equivalents) in relation to a mesh. I don’t quite get what the “number” represents for those as it seems to be a ratio more than any absolute “number.”

My first point of confusion is just trying to establish exactly where the “insert” position of the image might be in relation to a mesh (i.e. where on the mesh is 0,0 and where in the image in the texture is 0,0, since they do not seem to be the same). Then, based on image size (and possible scaling of it), how to “offset” the texture into a desired position on the mesh. Finally, how to then insure the rotation center is set to the desired position as well. If someone could first either point me to a good tutorial or walk through a “simple” example (i.e. a flat square mesh for example) of what those positioning properties do in relation to the mesh, that might help.

But my ultimate goal is more complicated than just a square (I’m just thinking maybe a square might help me understand things). I have a multicolored image to use as a texture:

I’m trying to figure out, in relation to any mesh, how to position the center (where the colors converge) of that image at a particular point on the mesh so that I can ultimately rotate (2-D) the texture around that point on the face plan it is applied to (including with possible scaling of the texture). My actual mesh is four pieces (see below), so I’m duplicating the texture to be able to manipulate individually, but I cannot figure out how to put the positioning of the texture on the pieces to have the control that I want since I don’t really understand the relationship of position, size, and rotation between the mesh, the texture, and the image acting as the basis of the texture. So here is the more complex shape:


pinging @syntheticmagus

Hi Scott_Smith,

UV-ing can be a pretty gnarly topic, so I don’t think it’d be helpful for me to dive into that in depth because I could never do it as much justice as a proper overview. If I’m understanding your question, though, it’s important to realize that mesh UVs, which control the “insertion point” and other behaviors of a texture applied to a mesh, aren’t required to follow any particular convention that would allow them to be predicted generally. UVs are an inherent part of a mesh, and they vary unpredictably by mesh such that you can’t make assumptions in the general case about how they’re going to be arranged spatially. You can set the UVs to be spatially consistent from a particular viewpoint, but that’s more complicated than it sounds on several levels.

If you just need a relatively quick solution that will allow you to get that multicolored image onto, as you say, any mesh, I’d look into Projection Textures (Playground example). This essentially injects the texture into the mesh’s shaders through a “light” variable instead of a “texture” variable; and because light calculations are based on world space instead of UV space, it’s much easier to be sure that your results will be spatially consistent with the texture regardless of how the underlying mesh is constructed.

Hope this helps, and best of luck!

@syntheticmagus Well, at least now I grasp why all my experimenting to control the positioning was not following any rules I would have expected :grin:. The overview helped me understand that the UV space is related to the model’s unfolding. The projection texture won’t work, as I would need a spotlight (the only light apparently it works with) for each mesh to individually control the position/rotation on each one.

So that being the case, even if complicated, do you have any good resources for understanding of the setting UV’s spatially and tools to help visualize this? I haven’t searched, but the model was built in Blender, so is it possible to set that information there and remain set on the export to Babylon? Any further tools/links to guide me in actually being able to control the UV space in relation to my particular model would be appreciated.


You should, I think, be able to do all of your UV work in Blender, though I’m far from knowledgeable about that or any other 3D modeling topic. :upside_down_face: Once you’ve got the texture applied, getting it to rotate might require some custom shader work; you may need to apply a rotation to your UVs around the point (0.5, 0.5), then increase that rotation over time. It should be pretty easy to create a shader that does that using the Node Material Editor, though; there’s even an input node that does time, which is presumably what you’d use to change the rotation.

Thanks! I will give the tutorial a look and report back to let others know what I discovered.

Well, for what I needed to do, the solution here was not to worry so much about exact positioning of the texture (which, yes, it appears that Blender would have been very sufficient in doing the UV mapping), but rather making my texture image be seamless on repeat. For me, even if I positioned the image in the UV map, I would have still had the main issue I was trying to resolve (that I thought precise positioning would fix, but really wouldn’t), which was seams showing as I moved/rotated the texture and it repeated itself. So refactoring the image to a seamless image fixed my issue.