Texture stretch

Hello. This might seem a stupid question, but how can I apply a texture on a plane, without stretching it if the plane gets larger? Thanks

You need to multiply the texture coordinates by the plane scale. That is, if you stretch the plane by scaling it ^^

Thank you for the reply. Yes I am stretching the plane by changing the scale. What I want is that the texture is centered and maintains it’s aspect ratio no matter on how much I scale the plane. I’m sorry if this question is dumb, but I have little experience with shaders, can you give me a small example please?

Doesn’t matter; unrelated:
http://unity3d.com/support/documentation/ScriptReference/Material.SetTextureOffset.html

The shader multiplies UVs by “Tiling”, then translates them by “Offset”. So it’s related to shaders, but this isn’t the appropriate forum section for the question, as you script this or use the Inspector GUI.

799321--29319--$Screen Shot 2012-01-13 at 7.25.28 AM.png

What should happen if the plane is moved? Should the texture move with it?
What should happen if the plane is rotated? Should the texture rotate with it?

In general: how should the texture coordinates u,v depend on the position of a pixel x,y,z in world space?
If you can answer that question, it’s easy to write the shader.
If you cannot, you are asking an ill-posed question which allows for lots of valid answers.
What then might happen is that people offer you an answer and you dismiss it because it is not quite what you wanted.
Then you will make your question a bit more specific but still ill-posed and the game starts again.
Have fun. :wink:

(Or ask well-posed questions. :wink: )