Using min3D for Android – Q&A session: Common texture issues and Blender import
The previous post concerning min3D raised a lot of interesting questions and comments (thanks to all the visitors for their contribution!) concerning the usage of textures, the export of OBJ and the addition of features such as rotation listeners in min3D. I’ve decided to wrap up all of the comments and emails I’ve received concerning min3D. I hope you can find a solution for your problem, and don’t forget to post a comment if you can’t find the solution for your problem. I will edit and update this page with your input and your question, so don’t hesitate!
Blender and min3D: how to export the OBJ 3D model?
Oh yes, this is the most frequently asked question: how to correctly export OBJ from Blender to min3D. Here is a small tutorial to explain you each step. Some “hacking” is needed, so be sure to know how an OBJ and .mtl files work (not very difficult: http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html)
I will be using the latest version of Blender (2.58a) for this tutorial, so be sure to use the same version, otherwise you will get faulty OBJ exporter. Yes this is a real problem, because the previous version of Blender couldn’t export the .mtl file correctly; in fact it was missing, leaving developers to create and edit manually a .mtl or to reconvert and re-import the OBJ over Daz3D.
So here is the start point in Blender, a textured dice (yes, a really basic example ):
The cube has 6 textures (stored in a file named dice.png). The texture has a size of a power of two (1024×1024). After applying the texture to the dice we will now export it.
Blender will now export the obj and the .mtl file. Please note that the path contained in the .mtl is false and must be manually edited.
Change the file path to the correct usemtl
and of course a small modification in dice.mtl on the map_Kd line:
And here is the result:
Here are the files:
Since the newest Blender version, the OBJ exporter works as expected and can be used to export OBJ for min3D.
Daz3D and min3D: how to export the OBJ 3D model?
If you prefer to use Daz3D (www.daz3d.com) for creating and generating your 3D models, here are the parameters for the export of OBJ models:
Then you must manually edit the generated .mtl and .obj in order to set the correct paths to the textures.
Help, my texture does not display on the 3D object!!!
This is the most frequently asked question and I must say the most interesting because obviously there are some differences between devices, but let’s start with the simplest solutions to common texture problems:
#1: Check the mtl file
There is a slight problem with the mtl files generated by several 3D softwares: they contain bad characters (ok not bad, but hidden) that might be not correctly parsed such as return carriage/lines (/r /n) and tabulations (/t). The solution is to remove the tabulations at the beginning of each line in the mtl, otherwise the texture won’t load.
#2: Check the path in the mtl file
The mtl file contains in its first line the path to the .png / .jpg. Check if this path is correct.
#3: The NotPowerOfTwo problem with OpenGL on Android devices
This is the weirdest problem, and unfortunately there is not a lot input about this. I’ve never noticed this problem on my Android device (Dell Streak) till the day I’ve got message from users telling me that they couldn’t load textures on their Nexus S.
I first thought something else might be wrong with the paths till I’ve tested it myself: no textures!
But what is the difference between the Dell Streak and the Nexus S? Apparently there is a curious difference between the implementation of OpenGL on these Android devices. In fact some devices have not the support of NotPowerOfTwo textures in OpenGL. Many visitors also faced this problem; apparently the support of NonPowerOfTwo textures is not completely implemented/ not supported in OpenGL in some Android devices (http://code.google.com/p/min3d/issues/detail?id=5&can=1&q=NPOT) and http://stackoverflow.com/questions/5705753/android-opengl-es-loading-a-non-power-of-2-texture, meaning the way OpenGL is implemented in each device might differ. That’s the reason why the Dell Streak shows the textures and the Nexus S not (that is my explanation).
But there is another problem linked to this NotPowerOfTwo problem: min3D loads all the textures into a TextureAtlas (http://code.google.com/p/min3d/source/browse/trunk/src/min3d/parser/AParser.java).
The texture atlas is a sort of big texture composed by each single texture. Min3d will reference internally to this “big texture” and here seems to be a caveat on some Android devices : in fact you must also take care that the whole texture map (TextureAtlas) is a power of two, meaning if you have 4 textures à 512x512px each it will work but if you have 5 textures à 512x512px each it won’t work because 2560 is not a power of two.
Be aware that this is my personal explication to the problem; I couldn’t find any other explanation to this problem especially a list of Android devices supporting the NotPowerOfTwo textures in OpenGL. But in any case you should always use PowerOfTwo textures: they are quicker to load.
The 3D object does not appear!
Solution #1: Check the raw/your_obj path
This is a very common mistake: please check that the path to the OBJ file is correct and contains the full package name (com.yourPackage.). Note that you don’t need to put the extension .obj to the file path.
IParser myParser = Parser.createParser(Parser.Type.OBJ, getResources(),"com.testObj:raw/face_obj",true);
Anyway, the missing file or bad path will lead to a Resource$NotFoundException. That should be a first hint to check if the path to the file is correct:
Solution #2: Check the scale
This sounds stupid, but especially if you are using several programs to generate your 3D object, you should be aware which scale you are using: Blender and DAZ 3D are not using the same scale leading to export sometimes huge 3D models. The best way is to test several scale parameters.
faceObject3D.scale().x = faceObject3D.scale().y = faceObject3D.scale().z = 0.5f;
This is also the case when you are loading an OBJ found on the web and if you don’t know which scale units where used by the exporter.
|Print article||This entry was posted by MatD on August 12, 2011 at 11:08 pm, and is filed under Android, Mobile, Techzone. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed.|
No comments yet.
about 7 months ago - Comments Off
Here’s quick tip I wanted to share because you might face this little issue: you have eventually recorded some voice notes with the Samsung Android application and wanted to share these it with your friends or integrate it into an email and then… you found out that all your notes were recorded as .3ga files…
about 1 year ago - Comments Off
In the previous tutorials about min3D for Android we took a closer look on how to optimize the work flow from Blender or Daz3D to min3D. In today’s article you will learn how to easily change the texture of a 3D object stored in *.obj or *.3ds format. Although this sounds very easy while writing…
about 1 year ago - 7 comments
I read that a lot of people are having problems with the Unity WebCamTexture and Android. Indeed the problem comes from the fact that the texture streamed from the webcam is always flipped by 180 degrees and you will always get a wrong rotated picture of the camera (even if you turn your device (see picture)).…
about 1 year ago - Comments Off
This tutorial is about creating and compiling your own Unity GPS Plugin for Android. I wrote this tutorial in order to help those who are getting angry and fed up with missing information about the process of writing their own Unity Android plugin. My motivation was to get real speed values out of the GPS…
about 2 years ago - Comments Off
Believe me or not Unity 3D will be the next hype in the indie game industry and once you have discovered this tool and exported your 3D scenes to your iPhone, Android or even Flash (thanks to the new Molehill support) you will understand why. But that’s not the point of our discussion There is…
about 2 years ago - Comments Off
This is perhaps one of the most frequently asked questions on the web: you’ve downloaded a nice FLV (let me guess, from YouTube ) and you want to convert it into a MP3 to be able to play it on your iPhone or mobile phone. How to realize this? Yes, there are tons of FLV…
about 2 years ago - 48 comments
When you want to visualize 3D content on Android phones you have several solutions and frameworks. While using Actionscript with Away3D (with GPU activated in AIR) might be the quickest solution to display low polygon models, what should you do when you want to integrate a more complex 3D view in an existing Android Java…
about 2 years ago - 11 comments
Molehill aka Stage3D will be the next revolution for Flash and AIR. The new Adobe Flash Player will fully support 3D by allowing developers to use a set of low-level GPU-accelerated APIs. What’s pretty cool is that the 3D capabilities will be available also available for Mobile, TV and Desktop-based AIR applications. The best way…
Calisto – a new terminal for Web 3.0 and the Internet of Services – Frisbee gesture with an Android phone to surf in the semantic web
about 2 years ago - 1 comment
Simon Bergweiler and I decided to continue our research in the field of interaction with the Internet of Services. The result is Calisto, a 40’’ multitouch terminal that can be used either over touch interactions or by speech. What’s pretty cool is that users can send (or let me say throw) picture they shot with…
about 3 years ago - 6 comments
In this tutorial you will learn how to develop Android application with the Android SDK without a device and without using the SDK’s emulator. What? Yes it’s possible with Android X86 and a virtual machine (in our case we take Virtual Box) to setup your machine in order to test and implement your own Android…
Comments are closed.