type Conversions from Obj (3D Model) file to .h and .c
Does XCode provide conversions from Obj (3D Model) to .h and .c file ? I am bit lazy to write code for this conversion. Or any off the shelf product available?
Just curious, what is "Obj (3D Model)"? I used to do CAD work and a "3D Model" is a 3d solid modelling of a real Object. not code. It describes through Vectors and surfaces the physical object it displays. Are you trying to convert a 3D model to a graphic for use in your XCode project?
Any 3D model file (ds,.3dm, .asc, .bvh, .c4d, .cob, .cgm, .chm, .csm, .dae,
.dwf, .dwg, .dxf, .fbx, .flt, .geo, .iv, .lwo, .max, .obj, .off,
.raw, .rh, .skp, .stl, .svs, .u3d, .vrml, .w3d, .wrl .x, .xsi
) types. I am sucessfully able to convert square and cube models to .h and loaded into IPhone. I am trying to do similar thing like teapot model from GLGravity sample code.
I have a some success for converting 3d model into iphone using .h files from *.obj model (similar to teapot.h model). Which is displayed using gldrawElements for low poly count models but with high poly count models displays big blob on the screen.
Here the thing I am trying to do. I have simple animation (run and jump) and trying to port into iphone. Animation means not taking about circling or moving image (*.jpg) from one end to another. (Simple 3D animation)
Looks like, data conversion from 3D model to C header types giving me troublr for high poly models. Any mathematical models are available for high poly count models? But high poly 3D models, it is a big performance issue on iphone..
Do any body know how do get skeletion, joint and IK information from 3D model and use in the Objective C world. It is very interesting to solve this puzzle.
Any gurus out there ..?
This is what I am trying to do:
Take a 3D model from (
http://www.the3dstudio.com) and convert that model into Objective -C and use that 3D Object(Model) in IPhone application. I am having issues with convertion. Even if I am able to solve this whether is it possible to port 3D animationt to iphone? I am banging by head against wall for last one month to solve this problem. I donot think I am able to solve 100 %, giving a shot
objective C is a programming language, like C or Java or even Basic. an H file is a compnent of that language. It sounds like your trying to convert from a solid object modelling system to another GRAPHIC format.
Many times on apple even if the extension isn't right, the Mac has saved what program it was created with and can still open it properly. so even if your saving it as an "h" file, that has nothing to do with Obj-C. That has to do with previewing pictures.
That is true .h is header file in C or Objective C. On mac it may be possible to open a view 3D model file if you have corresponding viewer software.
It is whole other story If one has to read a 3D model file on IPhone, because we donot have a "corresponding viewer software" on IPhone and also have hardware limitations.
One way to over this problem is to convert 3D model to Objective C readable header file, but in this process we lose of lot important data regarding (dynamic nature) animation, skeleton, joints and other information. In this conversion we will have basic information about vertexs, normals and texture. This information may be helpful in redrawing images from this static data and does not include dynamic data.
Here are the things I am looking answers for:
1) How do we retain maximum dynamic nature of 3D model?
2) Does IPhone supports or restrict any specific 3D model format?
3) Whether is it possible to read 3D model file from IPhone without converting into .h (header file)?
4) IPhone hardware capabilities?
That is true .h is header file in C or Objective C. On mac it may be possible to open a view 3D model file if you have corresponding viewer software.
It is whole other story If one has to read a 3D model file on IPhone, because we donot have a "corresponding viewer software" on IPhone and also have hardware limitations.
One way to over this problem is to convert 3D model to Objective C readable header file, but in this process we lose of lot important data regarding (dynamic nature) animation, skeleton, joints and other information. In this conversion we will have basic information about vertexs, normals and texture. This information may be helpful in redrawing images from this static data and does not include dynamic data.
Here are the things I am looking answers for:
1) How do we retain maximum dynamic nature of 3D model?
2) Does IPhone supports or restrict any specific 3D model format?
3) Whether is it possible to read 3D model file from IPhone without converting into .h (header file)?
4) IPhone hardware capabilities?
I am not familiar with using a header file for anything than the typical use in Obj-C of desciring for the compiler what to expect in a .m file. I didn't know you could write 3D object model data into it.
It sounds more like you wanting, in this case, to export the 3D model data to some kind of storage file, possibly a simple flat text file (maybe XML), with appropriate normal vector, bounds cooordinates, joint properties etc... Then write some Obj-C code to read this data in and display on the iphone.
Does anyone know anything about the use of a header file in this other manner?
convert 3D model to Objective C readable header file
Even if we pretend for a minute that it is possible to convert a 3D model to Objective-C, what makes you think that same, unchanged model is suddenly going to render any more quickly?
This is the code from the Teapot.h file. It DOES NOT contain anything to store or reproduce the solid. It runs an OBJ-C Procedure called "DrawTeapot" that draws the teapot. you need to research the rest of the teapot.M file to see how it does so, and how it stores the data.
#ifndef TEAPOT_H #define TEAPOT_H #ifdef __cplusplus extern "C" { #endif // Returns the number of vertices sent to GL. int DrawTeapot(GLint grid, GLdouble scale, GLenum type); #ifdef __cplusplus } #endif #endif
It is possible. I am working on optimizing rendering times Vs poly count. I am looking for help (reference material or mathematical models) in how to retain animation (dynamic nature) from 3D model.
Down load: IPhone SDK 2.2
Down load GLGravity sample code
Open project with xcode: GL Gravity.xcodeproj
Models/teapot.h (defines static data of tea pot)
teapot.h is header file, one can use in c or objective-c or any other c compiler. #include "teapot.h" in your *.c or *.m file. This header file only represents static data.