3D Model with use of textures [Android] - android

I am trying to find approaches on stamping multiple textures on an object (3D .obj) Android. But, I am unable to do so, I have tried min3d but not sure if it is the right way to do it?
Is there anything available around which is similar to this? Or How Should I approach this UI? Below is the UI of model and how I want to stamp an "image"/texture on it, in addition I want to change the color of the model / add text on it.
In addition, I am planning to give touches on it, by stamping username/label/textview at the back of the model by using rotation through touches.
Please guide, which SDK should I use on Android, what is the best approach to do it.

What you want is basically just rendering textures on a given 3D mesh, as far as I can see. You could take multiple approaches for this: The simplest being just texturing the actual object, but a more complicated approach could involve rendering the object and "stamp"&text textures separately, giving the illusion of being overlayed (Not preferable though, as this will be difficult to manage correctly).
For texturing, you can either attempt rendering different textures after each other (First the background, then the stamp, then the text), or combining the different elements into one texture (pre-processing) before rendering.
I recommend having a look at the following posts and articles:
OpenGL ES (which can do everything you want to do, but has a decently steep learning curve)
Switch to a different 3D rendering engine if you find it too difficult to use your current one (Many options, although most are fullblown game engines)
Loading 3D objects and textures for OpenGL ES rendering
Check out the following git snippets and articles on texturing in min3d: this, this article, this article on object loading
You did not provide any code displaying your current attempts, so it is difficult to say what exactly your problem is, and how to solve it. If you edit your question you might receive more concrete solutions besides just links to potentially helpful resources.

Perhaps working with the OpenGL ES 2.0 api might be an option. Take a look this repo here called the Android 3D Model Viewer which makes use of it, it might help you out.

Related

OpenGL ES Startup

I done a 1:1 copy of the iOS App "MohrenJass" to Android.
-> Austria Cardgame.. Good training example :)
Good introduction to Activity, Views, Canvas, Preference, APIs, and more
Now i done the OpenGL ES Sample from the Developer page.
I read about OpenGL but i have a Question about it.
There are realy some points in it who give me some hard times.
Matrix, vertex, shader, fragment, projection, camera,...
Its not that i not understand it, but only to know "do this when that"
is not enough for searching errors in code...
I think about trying the ReplicaIsland code next,
but should i start with OpenGL first?
I found this fro OpenGL -> Prefer it because its german
http://wiki.delphigl.com/index.php/Hauptseite
(Dont know if its possible with my stand of knowledge)
Also found this
http://www.learnopengles.com/android-lesson-one-getting-started/
Or skip this and go into ReplicaIsland?
Learning by doing was always a good way,
but sometimes its a punch in my face...
I wont to try next a simple 2D Application.
A Square to go left/ right, jump above a other Square or somthing.
Only for learning to reach someday my target of realy create a App :)
I also read something about Unity, but i think its not the way i should start that.
Possible if i know what i am doing it will get with it easy...
Well.. I hope you have any tipps for me!
As for libraries such as Unity or Cocos 2D and such you will be able to start with your application quicker but they usually limit your capabilities as a developer at one point or another. If this is for a purpose of creating a simple game then you should go for it. If the goal is to get as much knowledge as possible I suggest you try the openGL. It is not easy and it does not get easier over time but it is worth it. And if you later turn to some library everything will be as clear as day.
So about the tutorials and examples there is a fact that they are in most cases misleading. They will explain to you how something is done but the code structure will be completely unmaintainable. If you want a good code that will help you over time you should begin with creating a simple "debug" scene to which you can then add components you later expect to need. For instance you should create a class that can contain an openGL context which should later be extended to include caches such as textures, shaders... Then you should have a class containing the view you draw to, the frame buffer and the render buffers you use on it. It should contain all the necessary tools to initialize with view, enable depth buffers, stencil buffers, presenting the content... All of these and more can be more or less pasted from examples and tutorials, all you need to do is restructure them. This would be your base construct as you will be able to create all components to draw and present but can not draw with it. To test it all you can do is try to clear the buffer to some value and see if you get the expected result.
After this the fun part begins: Creating the classes to handle and compile shaders, classes to create textures from images, matrix stacks, VBOs... Again all of these can be pasted from web but need restructuring.
So when you have all this necessary tools you can actually start working on the game itself. At this point most people take the wrong turn. Try to create objects that contain all the data you need to present a certain element in your game. For instance you have a character which is defined with a location, speed and an image (texture). This object can then have a draw method and a move method. The draw method will use the location to translate the matrix, will generate or reuse some vertex data, bind the appropriate texture and simply draw itself. The move in this case will only use the speed to change the location. As you go deeper more components are usually added and the situation can get complicated. But imagine only having what I wrote above you can create 3 images: character, enemy, bullet; then create as many objects as you need at any time with this images, move them around as you please, create crash detecting (which is very simple with this data) and you have a simple game which can become very advanced very quickly only by adding a few tricks.

Interactive animations on Android

This may be a duplicate question, but none of the questions I found were exactly what I had in mind.
A friend and I want to create an App that lets the user play around with 3D objects on the screen. My friend is creating the objects and the animations in Blender or Maya. Therefore, the possible animations will be preset (not being programmatically animated). I have no experience in 3D programming and I naively suggested that he render the animations in Blender and send me all the frames. I would then play the appropriate animation by quickly running through all the frames. Each animation would leave the object in its original position so that it would be ready for the next animation.
Now that I've been thinking about it, that's a lot of images that I have to store in order to make this work. For every object, I would need to have all its frames for all of its animations, which maybe overkill.
Is there another way to play animations in an Android app? I considered just saving the animations as videos and playing them, but that would look horrible for our purpose.
I'd suggest min3D
Take a look at the animated troll example they have.
There are a lot of 3D libraries for Android. I would recommend AndEngine. Alternatively, you can just use the native OpenGL compatibility. Instead, ask him to send you the actual 3D files. Then you can use a library to render them.
EDIT: I just found this link. It'll probably help you. In my opinion, you should go through it and learn the whole package instead of just glancing a bit for this one little project; it'll help in the future.
Yes, there is a way you can manupulate the models you created in Blender. here is an example which uses Open GL in android to animate a 3D model created in Blender Check This Video Out. However it animates the object programatically, frame animation is indeed not worth if you wanna create animations that are long as you will run out of memory quick.

What libraries for interactive 3D model in Android AR app?

I'm asked to do an app with a 3D object mapped on a tag on the camera preview. The user should be able to rotate the 3D object on swipes, and to click on different area of the 3D object.
I'm investigating the different way to do it.
So far the best option I've found seems to be https://developer.vuforia.com/resources/sdk/unity, but I can't find whether it's possible to interact with the 3d model (rotate on swipe, define clickable areas).
Has anyone any experience with that?
I guess I can do it with some OpenGL, but I have no experience with it and it seems quite complex to start off with.
Is there any other library I should consider?
I would use OpenGL and start by the training tutorials on http://developer.android.com/training/graphics/opengl/index.html. Hope this helps! If you follow these tutorials you will be able to do what you want. ive tried unity and it is a really good engine too. and of course you can make an object clickable with unity! maybe using unity would be easier but the documentation on opengl is huge and is not that difficult to implement at least with first steps. hope this helps
The Metaio SDK can do all of that but I am not sure if it automatically provides the area of the model tapped, but you could ask here.

Recommended way to load (non-interactive) animations (made using Maya) into OpenGL ES on iOS and Android

So far we have been able to successfully load static OBJ files (converted to .h) into our OpenGL application.
We can then apply transforms to these objects in order to animate them.
The next step on our project is to have a professional 3D animator do the animations in Maya, and create a "Loader" to display them in 3D using OpenGL.
We have found lots of examples online that deal with video games and loading static models, but our animations will be absolutely pre-defined by the animator, we just need to load them.
It is important to mention we cannot render it int oa video because we are building this on top of an AR library which will let users literally walk around the animation, that part is solved, we just need to get the animations to render using OpenGL.
I have looked into this question regarding the appropriate format the animator should use to export from Maya.
.dae (COLLADA) file format seems to be a good way to encapsulate model and animation information, and the loading it using Assimp but we have not found this loader compiled for iOS or Android (which are the platforms we are developing for).
Another approach we have seen recommended online is to export a series of OBJ files and load the corresponding OBJ for each frame.
Another approach we see around is to use an "Engine", but there are so many it is hard to know which one we should focus on.
We do not mind paying for an Engine but how do we know which one will work best?
We found these examples, but we do not see a clear "Winner".
Has anyone gotten something like this working on iOS or Android devices?
What would be your recommendations?
Well, OpenGL(-ES) itself is just a drawing API, it doesn't do anything related to animation. Animation playback is managed by a own animation system. The output of such a system are transformation parameters, that you can later use to place and deform geometry when drawing with OpenGL. The usual approach to this these days is a skeletal animation system, i.e. you add some skeleton to the model, where each vertex is bound to a set of bones, with per vertex-per bone weighting. Bones can be represented as a combination of a translation and a quaternion. The translation usually is a constant, so what the usual animation system gives you is the vector of quaternions describing the skeleton pose. This you load into a uniform (a vec4) or a GL_RGBA32F 1D texture with the width being the number of bones, which is used in the vertex shader to apply per-vertex transformation based on the pose. The vertex-bone weights usually are submitted as additional vertex attributes.
I've done a 3D framework for Android and this is how I thought animation:
Skeletal animation ca be done simply with you code: load an OBJ for every limb and let the CPU do the skeletal computations, then transform each OBJ to the coordinates and angles given by the CPU.
Keyframe animation can be done by using OBJs that have the same number of vertices. You can then use linear function that takes a variable t(time) and gives you the combined mesh. You can also use Bezier curves for smoother animations.
Another aspect I'd like to point is that you can import MD5 files. MD5 files can contain animation data and they're binary, so loading them is fast and does not require a parser.
More on MD5s here.
P.S. If you want, I can recommend you a great book that covers a lot of 3D issues when developing on mobile; just leave a comment. And.. if you don't mind spending money, just buy Unity. It's very good and it's very versatile.

What does a 3D Engine do for me?

I'm interested in developing an android application that will display a globe of some sort like Google Earth.
I've never used opengl or have any experience with graphic programming so I'm here to learn some basics. Now, I know there are things like the Unity or Ogre that help facilitate graphics but what exactly do I gain from using these engines as opposed to just using opengl api to render graphics? Why do you use engines like Ogre as opposed to straight up opengl?
There's a lot more to creating a graphics application than just a 3D library.
Libraries like OpenGL map the hardware-specific functionality of your graphics hardware (as well as emulate unsupported functionality in software), but that's just the beginning.
First of all, you need to manage your objects. You need to find a way to convert them from your 3D software (Maya, Max, Blender) to whatever data format you want to store them in your application in, and you need to store them in your application somehow using control structures.
You need to transform them, animate them, skin them. You need a scene management to easily cull out objects outside the frustum. You need a camera and move it.
You need to handle lighting, light sources. You need to handle render passes, like a light pass, shadow pass, reflection pass.
Then you need some good shaders, some that support features like diffuse maps, normal maps, specular maps, ambient occlusion maps, light maps, that support point lights, directional lights, spot lights.
You need to manage textures, stream them in and out and apply them to your models.
So... those are some of the things a 3D engine package does for you. And a lot more.
EDIT: That said, if all you want is display a globe, using a full-blown engine is overkill. For that, you want something like OpenGL, create a model of the globe (=a simple sphere), apply a texture to it, set a light or two, and render it.
A 3D engine will help you with a number of things :
They usually come with predefined data formats, so you don't have to create yours. Sometimes they also come with tools with nice interfaces that help you create 3D objects. Or, they can load or convert popular file formats so you can use popular tools to create your 3D.
They come with rendering loops and maybe event loops so you don't have to implement those. It's often easier than doing it yourself.
They come with already written algorithms to do hidden surface removal.
They come with high-level functions to easily do complicated stuff with the objects they provide you.

Categories

Resources