8

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

Roksalt
  • 481
  • 6
  • 19
  • 2
    Sorry? No sorry needed. Even noob questions expand human knowledge. And Stack Overflow reputation, of course. Also: +1 for asking a good question. I rarely see a good first Q by a newcomer. –  Mar 07 '11 at 01:37
  • Do you have any (u, v) coordinates getting through at all? – Tommy Mar 07 '11 at 12:42
  • 1
    I'd like to the see the output of your script. I have a hunch that you're doing another n00b mistake and fell for the misconception to export your model into actual OpenGL commands - with OpenGL-ES this is actually a viable approach, due to the enforcement of vertex arrays, but you've to be carefull nevertheless. – datenwolf Mar 07 '11 at 18:37

1 Answers1

1

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
...

erkanyildiz
  • 13,044
  • 6
  • 50
  • 73
  • Hey cruor, Thanks for the reply. Where do I find the OpenGLOBJLoader. I searched it in google and found a link to it here http://iphonedevelopment.blogspot.com/2009/03/wavefront-obj-loader-open-sourced-to.html but the link appears to have been removed. Do you have a copy of the source? I was thinking it would be way easier to just figure out a way to read multiple textures into my Open Gl - ES app as this will give me more options down the track – Roksalt Mar 14 '11 at 22:41
  • 1
    here you can find the example and the class: http://bill.dudney.net/roller/objc/entry/wave_front_obj_textures_working – erkanyildiz Mar 14 '11 at 22:55
  • 1
    and this is about using blender to make uvmaps: http://www.virtualrealm.com.au/Blog/tabid/62/EntryId/465/Blender-3D-Texturing-a-Box.aspx – erkanyildiz Mar 14 '11 at 22:57