Human head texture mapping from pictures

Hi everyone,

I’m beginer at Unity, I found several way to texture mapping in Unity, and i want to know what’s the best solution to apply texture (from 2d pictures) to human head in unity using scripts.

Thanks in advance for your help

That’s not a task you would do in Unity as it requires a lot of tweaking which is usually done in an image software like Photoshop or Gimp. Unity actually is not such an image software. :wink:

Thank you for your answer,

Yes, i know that it’s not an image software, i’m planed to use Unity to map a texture to a 3d human head, the texture data will be extracted from pictures using OpenCV (applying classifiers and filters)

my problem is that i don’t kow how to map these texture data to my model in an automatic way using scripts, if i’m right there is several methods for that (UV Mapping, Mip Maps, Normal Maps, Atlas texture), any details about these methods?

I think youre overlooking one problem to start with; for a human head you need a fitting mesh.

Youre mentioning multiple terms and they all have to do with texture mapping, but theyre certainly not just ‘ways to apply a texture’.
Try investigating a little more in character development in general and unity itself before putting yourself up with a task as immersive as this.

I have alredy the human model exported from 3DS Max into unity and i’m working on it,
all i need for now is to know how can i make the mapping between the pictures texture data (extracted using OpenCV) data and the human model using script

Thanks in advance

Okay, i’ll go in a flash over a few things.
If they aren’t clear enough, please also look at the links provided :slight_smile:

  • UV-mapping > Simply said, a UV-map is a definition on how to lay-out your texture over the polygons.
    Basically all geometry’s coordinates are “mapped-back” to a U and V coordinate (which equivalent the regular X and respectively Y-axii, but for the 2d texture)

  • Mip-maps > Simply said, a Mip-map is a texture which consists of also smaller or compressed versions of a texture (used for reducing memory load and improving quality of textures which are further away)

  • Normal Maps > Also sometimes wrongly named BumpMap.
    a BumpMap is a greyscale image which contains info of the relative height of a part of the surface. A bump map map DOES NOT edit the geometry in any way, it is just used to enhance detail by trying to use a greyscale image to determine if the piece of surface is shifter more in- or outwards (black being in- , white being outwards)
    A normal map is the precomputed 3d-version of this, which is decoded using a lookup table, delivering more performance and detail then a normal BumpMap could (especially since a BumpMap only contains relative height, not relative angle of the piece of surface)

  • Texture Atlas > Most oftenly found in sprite-based games and mobile games. a Texture Atlast is a single large image which is basically a grid of smaller images, or in the case of mobile games, a collection of re-used texture parts which can be reused using UV-mapping.

Since you already have a 3d mesh, you are most interested in the technique of UV-mapping.
Once you’ve managed to get UV-maps, you can improve your model’s details by learning how to use NormalMaps :slight_smile:

Well I am not familiar with OpenCV and the kind of data you are able to extract from it, however I doubt that you will get the data in a format you need here.

Most importantly you will need to get a texture out of that data which you can apply to the mesh which you already got. However that texture needs to fill the mesh UV’s (see above) in exactly those spots where the user should see the corresponding color information on the mesh (not talking about normal maps, specular maps and so on). That means: Your head needs to have UVs assigned, and the texture needs to follow that UV layout to be displayed alright. And that is something which needs to be done manually, there is no way to make that process automatically happen - at least as far as I know (maybe technology advanced that much already and I missed the point of no return which officially makes me “old” ;)).

I guess your better option is to check whether that face recognition software also delivers three dimensional surface data. With that I can think of a solution which would imply to generate the corresponding mesh on the fly and then apply the color information you also get. No idea though how feasable that is in the end, if at all.

I am sure though that you won’t get the texture data you need to map to your UVs from OpenCV.