Assume I have a model and I don't map the UV for this model and I just apply a texture for the model. I see that Unity will apply a single color to the model, something like this (I took the img from this topic): model without uv

I guess the default pixel color it uses maybe at UV (0, 0) or UV (1, 1), but after I test it, I see that my guess is wrong, the colors doesn't match.

color uv

color 1: the color of the model when I apply the texture to a non-UV model

color 2: the color of pixel at UV (0, 0) of the texture (color = myTexture2D.GetPixelBilinear(0.0f, 0.0f);)

I see color 1 is lighter than color 2.

So how get get the color from the texture that matches color 1?

Edit I have tried another test:

Here is the texture (4 pixels with 4 different colors):

UV Test

And I got this color when I apply this texture to a non-UV mapping model:

non-UV mapping

It seems like they use an algorithm to make the non-UV color (like blend some colors of the texture together)


1 Answer 1


I figure it out, they blend 4 corner pixel of the texture to make the non-UV color.

I have a 16x16 texture (4 corners is: red, green, blue & black, the rest are yellow)

16x16 Texture

And when I apply the texture on a non-UV model, I get this color:

Non-UV color

But notice that the non-UV color is lighter than the blend color of 4 corners, so here I propose this code to make the non-UV color, it's not perfect but good enough for me:

Vector2Int lastIdx = new Vector2Int(
            myTexture2D.width - 1,
            myTexture2D.height - 1);

color = (myTexture2D.GetPixel(0, 0) +
                myTexture2D.GetPixel(lastIdx.x, 0) +
                myTexture2D.GetPixel(lastIdx.x, lastIdx.y) +
                myTexture2D.GetPixel(0, lastIdx.y) + 
                Color.white) / 5.0f;
  • 1
    \$\begingroup\$ Just ot curiousity, why are you doing this? are you trying to emulate what Unity is doing in an home-brew game engine? \$\endgroup\$
    – user115399
    Feb 12, 2019 at 8:33
  • \$\begingroup\$ @GabrieleVierti - No, I just need to get this color for a specific feature of my game. \$\endgroup\$
    – 123iamking
    Feb 13, 2019 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .