Tuesday, May 26, 2015

Cocos2d-x: Converting fbx to c3b

If you got a 3D model in  fbx format with the textures placed in a separate folder, eg.

soldier.fbx

but the textures are in another subfolder:

Tex/body.png

Then, when doing the conversion using fbx-conv tool, put the subfolder containing the textures in the same folder containing the soldier.fbx, eg.

soldier.fbx
Tex/body.png

Then, do the conversion:

./fbx-conv soldier.fbx

Then copy the soldier.c3b file that is generated to your target Resource folder of your iOS project, and copy the contents of Tex to the target Resource folder of your iOS project. Do not create a Tex subfolder in the Resource folder of your iOS project.  You should have something like this:

soldier.c3b
body.png


Then, after creating the 3D sprite in your game, if you get this error:

GL_CLAMP_TO_EDGE should be used in NPOT textures

it means you are not using power of 2 textures. NPOT means Not Power of Two. To solve, open your textures and resize to power of 2, e.g., 256 x 256, 512 x 512 etc.




No comments:

Post a Comment