+1 vote

I need to set the albedo texture of certain objects in my project at runtime - sort of like skinning an object or customizable billboards. The actual objects are simply square tiles with beveled edges that I need to stretch my user selected images to cover edge to edge, and while I can rotate the tiles after the image is applied it would be nice to have the option of applying the texture in the required orientation to start with.

How are texture maps aligned and scaled in godot?

in Engine by (20 points)
retagged by

This depends on the UV-mapping of the mesh (tile) you are using. Nothing special about this in Godot. You usually control the UV mapping in the 3D editor. But you can also edit UVs using the MeshDataTool (remove a surface, edit it and add it again):
https://docs.godotengine.org/en/stable/classes/class_meshdatatool.html

This can be helpful if you want to automatically assign UVs for certain materials.
Each vertice has one or multiple UVs which index (from 0..1) the x/y position of that point in the texture.

For vertices which have multiple UVs (i.e. adjacent materials or "loops") you usually have multiple vertices on the same place (or in different surfaces).

Or you can write some shader and do the texture lookup depending on your own criteria in the fragment shader.

SpatialMaterial also allows a limited control over UV mapping via uv1_offset and uv1_scale. Maybe it'll suffice to put negative values in parts of the scale.
https://docs.godotengine.org/en/stable/classes/class_spatialmaterial.html

For albedo it'll usually be uv1. UV2 are for other purposes like lighting/ao/emission or custom use in shaders.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.