Search code examples
iphoneopengl-es3dcinema-4duv-mapping

Put a Cinema 4D model and Texture into an iPhone App


Im an iPhone developer and i'm trying to get a 3D model that I create in Cinema 4D into an app im making. I have actually found a way to get the model in (by exporting it as a .dae or obj and using a python script) which works really well however I can't get the textures to come with it. My script actually can only handle 1 texture as well.

Basically I need to ether create and export a UV map in c4d (but I have no idea how to do this) or I figure out a way to read multiple textures into my Open Gl - ES app with a script or PowerVR. (this is probably better)

Sorry for the noob questions but im very new at the 3D world.

Cheers


Solution

  • I would recommend that you use Blender. Export your Cinema-4D model for Blender and use Blender to create UVMaps.

    You need to make seams and unwrap the model. After that save a targa template for your texture, apply your texture on that targa. Save it as png or jpg. Apply that texture image to your model in Blender. Now you can export Wavefront OBJ file.

    Use OpenGLOBJLoader class to render your model in iPhone. And one more thing: you should invert (subtract from 1) texture coordinates on y axis in order to get your texture rendered properly.

    For example, if you have texture coordinates like this:

    vt 0.800008 0.400000
    vt 0.800008 0.150000
    ...

    make sure that you have them inverted like this:

    vt 0.800008 0.600000
    vt 0.800008 0.850000
    ...