Topic locked

Augmented reality on 3D Model (.MAX files)

November 15, 2012 - 12:17am #6

Hello! 

I would like to ask if there is any samples projects that would allow

a 3D max pic to appear above the marker when the android camera scans it?

 

Thanks! 

 

Augmented reality on 3D Model (.MAX files)

November 15, 2012 - 2:29am #5

Hi,

there is no such example for directly using files in .Max or .OBJ formats;

however, you can convert those models to OpenGL format (i.e. to a header file that you can compile with your project);

the following post explains how to do that (in particular for OBJ files):

https://ar.qualcomm.at/content/android-how-do-i-replace-teapot

 

For .MAX files, the best would probably be to first convert/export them to OBJ, then follow the procesure in the post above.

 

The alternative is to use the Vuforia Unity3D extension; with Unity you can import models in various formats.

 

 

 

Augmented reality on 3D Model (.MAX files)

November 15, 2012 - 5:54pm #4

Hello!

I would like to replace the 3D model from the 3D sample ImageTarget,
I have seem the link you have given me, I am still unsure of where do i replace my 3D model 
with the sample codes one. It seems quite confusing, cause an 3D model have (.OBJ, .MTL & [JPEG or TGA] ) files.
Therefore, where do i replace the codes and import the files?

Thanks! :) 

Augmented reality on 3D Model (.MAX files)

November 16, 2012 - 2:52am #3

Hi, if you follow the instructions in the thread I pointed to, you'll see that a tool is used, called obj2opengl;

when you apply it to your "MyModel.obj" file (ignoring for now the materials/textures), this script will produce a "MyModel.h" file;

so, you will need to copy "MyModel.h" (or whatever its name) into the "/JNI" directory of ImageTargets sample, i.e. next to all other .cpp and .h files that you find there.

Then, in ImageTargets.cpp you need to add an include, i.e. where you currently find the #include "teapot.h", add:

#include "MyModel.h"

Then you will need to adapt the code that you find in the "Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame" function (see where the various "glVertexAttribPointer() " lines of code are located); this is also explained in detail in the Thread I was referring to in the previous message.

 

About materials (i.e. the OBJ material with diffuse, specular, ambient parameters); that is not supported out-of-the-box, so if you want to have the exact same material that is in the OBJ mesh, you will need to write a shader that supports diffuse + specular + ambient + texture, and replace the existing shader code; this is located in "CubeShader.h"; 

this step of course requires some familiarity with shaders and OpenGL, otherwise it's going to be a bit difficult.

 

However, if it is sufficient to use one single texture on your model, and if you don't care too much about the diffuse/specular lighting, you can just replace the currently used "TextureTeapotBlue.png" or  "TextureTeapotRed.png" or "TextureTeapotBrass.png" with your model texture image (these files are located under the /assets directory in the project).

 

An alternative approach (which would avoid you to go through the process above) is to use Unity3D Vuforia extension; in that case you can really import several models without worrying about these aspects, as they are automatically handled by Unity.

 

 

 

Augmented reality on 3D Model (.MAX files)

December 15, 2014 - 2:39am #2

Is there an updated guide for including *.h files?

 

In the latest Vuforia SDK, there are no *.cpp files to add the import to.

 

You could really do with updating all of your documentation as it is all terribly out of date and confusing.

Augmented reality on 3D Model (.MAX files)

December 15, 2014 - 3:12am #1

In the latest Vuforia SDK, there are no *.cpp files to add the import to.

Not quite correct;

if you take the ImageTargetsNative-3-0-5 sample

from here:

https://developer.vuforia.com/resources/sample-apps/image-targets-c

This shows an example of how to use a .h header file to load and render a 3D model in OpenGL using C++ (with cpp files).

 

For a Java-based approach to rendering 3D models in Android and Java, you can see this up-to-date article:

https://developer.vuforia.com/resources/dev-guide/replacing-teapot

 

Also, for more general guidelines on how 3D models can be handled in Vuforia, please read this:

https://developer.vuforia.com/forum/faq/technical-what-3d-model-formats-does-vuforia-support

 

Topic locked