(Unity C #) Texture2D scaling secrets

Well, I saw a few threads there about scaling Texture2D both here and on the Unity forums. This search line has now led me to scale Texture2Ds with this class: http://wiki.unity3d.com/index.php/TextureScale

Now what I'm working on now applies decals directly to the target texture. This works great. BUT, depending on the size of the texture and how much it scales in geometry, the sticker appears in different sizes (without any scaling, see the attached image). It made me even look at the scaling of Texture2D.

The secret is that I’m not sure what kind of math you need to throw on the scale function to make the sticker the same size visually, no matter what grid and texture it is on.

decal diff size based on mesh

Any help is much appreciated:]

+4
source share
1 answer

If the texture is twice as large, the decal will be twice as large. So, scale the decal in half and it will be a normal size.

In general, in every place where you multiply the scale of the texture, divide the scale for the decal by the same amount.

0
source

Source: https://habr.com/ru/post/1526340/


All Articles