# unity - What's pixel of texture when there is no uv mapping?

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):

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 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):

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

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

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)

And when I apply the texture on a non-UV model, I get this 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:

color = (myTexture2D.GetPixelBilinear(0.0f, 0.0f) +
myTexture2D.GetPixelBilinear(1.0f, 0.0f) +
myTexture2D.GetPixelBilinear(1.0f, 1.0f) +
myTexture2D.GetPixelBilinear(0.0f, 1.0f) +
Color.white) / 5.0f;

• Just ot curiousity, why are you doing this? are you trying to emulate what Unity is doing in an home-brew game engine? – Gabriele Vierti Feb 12 at 8:33
• @GabrieleVierti - No, I just need to get this color for a specific feature of my game. – 123iamking Feb 13 at 3:15