I'm trying to reproduce a textured head in Mathematica, and I'm using a kind of 'net' of a head which contains all the features on the face. The texture looks like this:
which is supposed to look something like this:
Here's the code I'm using.
ListSurfacePlot3D[Import["inputImage.obj", "VertexData"],
PlotStyle -> Texture[texture], Mesh -> None, MaxPlotPoints -> 80,
TextureCoordinateFunction -> ({#1, -#2, #3} &)]
which gives me
Another problem is that the texture is reflected about the origin (ie the face is plastered on the back of the head as well). It should instead be black on the back of the head mesh. I suppose this is suppose to do with the head being centered at the origin. I also need to have the texture to 'follow' the head when I change the coordinates of the mesh later on.
I have attempted using
Graphics3D[
{EdgeForm[],
Texture[texture],
GraphicsComplex[mesh,
Polygon[polygon, VertexTextureCoordinates -> mesh]]}]
but it gives me this instead
I need to be able to reproduce this in Mathematica as I have some coordinate transformations which I need to apply, and thereafter, 'wrap' the mesh with the texture. Are these possible?
EDIT: The link to the model is located https://git.io/viJXD
EDIT 2: I've tried converting the OBJ to PLY and I did this
Import["inputImage.ply", "UserExtensions"][[2]]
Import["inputImage.ply", "UserExtensions"][[3]]
which gave an output of
"texture_u" -> {..}
"texture_v" -> {..}
where .. was a bunch of numbers which had a Length
of 3066 for both. My guess was that these are texture coordinates (where u is horizontal and v is vertical) as per the links provided by Rahul Narain.
I attempted to create a list of coordinates from these two list in the following manner
texturecoord = {Import["inputImage.ply", "UserExtensions"][[2]][[2]],
Import["inputImage.ply", "UserExtensions"][[3]][[2]]} // Transpose
Then, I tried doing
Graphics3D[
{EdgeForm[],
Texture[texture],
GraphicsComplex[mesh,
Polygon[polygon, VertexTextureCoordinates -> mesh]]}]
But that gives me this
ListSurfacePlot3D
is quite appropriate for Halloween. That face is.... scary. $\endgroup$