Log in or register to post comments

Export from Blender doesn't show up correct in Vuforia (iOS)

January 3, 2014 - 1:37am #1
I have the following model in Blender (A basic model of a woman with clothes - textures are included in Blender): VIEW IMAGE.
 
 
I've used the BlenderVuforiaExport plugin to export to a `.h` file that is compatible with the example files from Vuforia. I've downloaded the (simple) Image Targets example, and wanted to load the model in there.
 
But, because the model in Blender is created from several shapes, the plugin creates a lot of objects like (based on the names of the shapes):
 
    shapeIndexedFaceSetObject
    shapeIndexedFaceSet_001Object
    shapeIndexedFaceSet_002Object
    ...
    shapeIndexedFaceSet_030Object
    shapeIndexedFaceSet_031Object
 
I've made some changes to the `EAGLView.mm` file to load all the objects on the same target.
    - (void) setup3dObjects
    {
        NSValue *boxed00 = [NSValue valueWithBytes:&shapeIndexedFaceSetObject objCType:@encode(struct BlenderExportedObject)];
        NSValue *boxed01 = [NSValue valueWithBytes:&shapeIndexedFaceSet_001Object objCType:@encode(struct BlenderExportedObject)];
        // More objects here
        NSValue *boxed31 = [NSValue valueWithBytes:&shapeIndexedFaceSet_031Object objCType:@encode(struct BlenderExportedObject)];
        
        NSMutableArray *objects = [[NSMutableArray alloc] initWithObjects:boxed00, boxed01, boxed31, nil];
        
        for (int i = 0; i < [objects count]; i++)
        {
            Object3D *obj3D = [[Object3D alloc] init];
            struct BlenderExportedObject unbox;
            if (strcmp([[objects objectAtIndex:i] objCType], @encode(struct BlenderExportedObject)) == 0)
            {
                [[objects objectAtIndex:i] getValue:&unbox];
                
                obj3D.numVertices = unbox.numVertices;
                obj3D.vertices = unbox.vertices;
                obj3D.normals = unbox.normals;
                obj3D.texCoords = unbox.texCoords;
                obj3D.numIndices = unbox.numIndices;
                obj3D.indices = unbox.indices;
                
                obj3D.texture = [textures objectAtIndex:0]; // Just use the teapot texture for now
                
                [objects3D addObject:obj3D];
                [obj3D release];
            }
        }
    }

 

 
When I now run the project, it does render the several shapes. But strangely, the objects seem to "float" mid-air and don't have the correct scale. In the result below, you'll see that the feet aren't attached to the legs, and the arms are just "floating" at a big height. The head is even further up the air. VIEW IMAGE.
 
I'm pretty bummed right now; I thought this page might help me, but I can't seem to get any further to get all the shapes in the correct place. I hope anyone can help me out here (and maybe knows the way how to add the textures later on) - thanks!
 

Export from Blender doesn't show up correct in Vuforia (iOS)

January 6, 2014 - 2:59am #6

That's great :)

N

Export from Blender doesn't show up correct in Vuforia (iOS)

January 4, 2014 - 3:36pm #5

Thanks for the tip Nalin - I got it working within a day using Unity, while Objective-C took me a couple of days already (and wasn't finished yet).

Once again, thanks for the help!

Export from Blender doesn't show up correct in Vuforia (iOS)

January 3, 2014 - 10:50am #4

Searching the web for "export blender opengl es" would be a start:

http://www.raywenderlich.com/48293/how-to-export-blender-models-to-opengl-es-part-1

 

Note this is non trivial if you are new to OpenGL ES which is why we recommend Unity as it will save you weeks if not months of effort.

 

N

 

Export from Blender doesn't show up correct in Vuforia (iOS)

January 3, 2014 - 9:20am #3

Thanks for the fast reply Nalin. How can I achieve this?

Export from Blender doesn't show up correct in Vuforia (iOS)

January 3, 2014 - 6:25am #2

Have you tried simply displaying this in a test OpenGL ES application without using any Vuforia?

This might help you narrow down the problem.

 

N

Log in or register to post comments