opengles display human face in iphone

后端 未结 1 1894
遥遥无期
遥遥无期 2021-01-01 05:38

I need to make a human 2D face to 3D face. I used this link to load an \".obj\" file and map the textures. This example is only for cube and pyramid. I loaded a human face \

相关标签:
1条回答
  • 2021-01-01 06:09

    mtl2opengl is actually my project, so thanks for using it!

    1) The only way you can achieve perfect texture swapping without distortion is if both textures are mapped onto the UV vertices in exactly the same way. Have a look at the images below:

    Texture Swapping with misaligned vertices

    • Model A: Blonde Girl
    • Model B: Ashley Head

    As you can see, textures are made to fit the model. So any swapping to a different geometry target will result in distortion. Simplified, human heads/faces have two components: Interior (Bone/Geometry) and Exterior (Skin/Texture). The interior aspect obviously defines the exterior, so perfect texture swapping on the same .obj file will not work unless you change the geometry of the model with the swap.

    2) This is possible with a technique called displacement mapping that can be implemented in OpenGL ES, although with anticipated difficulty for multiple heads/faces. This would require your target .obj geometry to start with a pretty generic model, like a mannequin, and then use each texture to shift the position of the model vertices. I think you need to be very comfortable with Modeling, Graphics, Shaders, and Math to pull this one off!

    enter image description here

    • Via Wikipedia

    3) I will add more transform options (scale & translate) in the next update. The Xcode project was actually made to show off the PERL script, not as a primer for OpenGL ES on iOS. For now, find the modelViewMatrix and fiddle with this little bit:

    GLKMatrix4Scale(_modelViewMatrix, 0.30, 0.33, 0.30);
    

    Hope that answers all your questions!

    0 讨论(0)
提交回复
热议问题