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.
Related
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.
So, for a personal project, I'm trying to make an app that helps newcomers get used to the school quickly. And for one section of it, I'm trying to build a 3D Structure, in a shape of my school campus, with lables incidating where the rooms are, so when the using searches for specific rooms, they can easily find it. So, It would be like from one activity, when I click a button, it opens a new activity with a search bar on the top, and the rest of the screen a 3d image people can navigate through. What's a way I can accomplish this?
I know that the structure part can be accomplished with Unity, which I haven't learned but have an idea of what it is, but I don't know how to build the rest of the app with Unity.. So..
You probably want to start with designing the model (structure) in some-kind of modeling program, Maya, 3DS Max, Cinema 4D, Blender, etc... (Personally I recommend using Blender since it's free and open source). Then you would want to export it to some 3D model format, I recommend using .obj since it is very human-readable and easy to parse on your own, but you can use some other format and parse it using a library.
Now comes the more difficult part and it's to render the loaded model onto the screen. This can be accomplished with OpenGL ES or a more highlevel library which can abstract it for you. If you're not familiar with OpenGL ES or OpenGL in general, I wouldn't recommend using it since it may take some time to learn. There are few libraries out there which can render 3D models pretty easily. Now you should probably create some-kind of a controllable camera as well so you can use it to navigate through the model.
This maybe looks like a lot of work but if you already familiar with computer 3D graphics it can ease it up for you.
Well, you can make a 3d model of your school using Blender (which is a free tool, but will almost certainly be a lot of work). Export the model as a mesh which you can insert into your app as an asset or resource. Read the resource and present it using (probably) opengl. This is a SUPER high level view, in actual fact there's quite a lot of work in each stage. Some third party libraries can make it a little easier, but it will still be a big job. I personally like libgdx for abstracting the pain of opengl, but that's just my personal opinion.
It's a big job, but would be super cool .. good luck!
I recommend starting off with building the structure in a program like Blender, Maja or 3ds Max. You can export your projects from those programs to pretty much any game engine and it makes more sense to build things in one of those programs.
Once you're done with that you can choose which engine you want to use to add the search function, if unity or Unreal or whatever but either way you're going to need to make yourself familiar with java or c to add the search function.
I recommend to use blueprints of building if available, it will save you a loads of nerves. Use it as a material texture and place it on a plane polygon to get a good lining helper.
If you do use Unity for development then try Maya for polygonal modeling. At least they are looking similar to each other whereas 3DSMax is always a mind f*cking experience.
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.
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.
I've been able to import 3D models from Maya into OBJ files, which in turn, are read by my Android app. This model can now be displayed and I can apply transformations on them as well, even on high-polygon count objects, which is nice.
The next step is to figure out if there's any reasonable way to display animation defined within Maya. I really have no clue how to approach this and my initial research on this essentially came up empty.
Has anyone attempted this before? If so, how would this work?
I think it's worth noting that this question has little or nothing to do with Maya. Maya's file formats are proprietary and opaque; you will NOT find a way to directly display them on Android (or anywhere else, come to that). But you can export data from Maya to (basically) any format, which is what you actually want to do.
So, here's the process:
Figure out how you're going to display 3D models and animations on Android
Figure out how to get stuff from Maya into the format your answer from step 1 requires.
There's a lot of ways to do step 1. For sheer ease of use I'd probably go for Unity myself. Basically it's game development tool that can create 3D apps and games that run on Android (and iOS, OSX, Windows, etc.) It's not free - the Android addon costs $400 - but if you're actually planning on doing anything serious with Android, you'll find it worthwhile. With it, it's actually pretty trivial to make a little Android app in Unity that displays an animated model (and a LOT of 3D Android and iOS games are made in Unity). Unity also wants models and animations in FBX format, which is a widely supported interchange format - you'll have no problems getting stuff out of Maya into FBX.
If you've gone with Unity in step 1, then step 2 is trivial: Export your models from Maya as FBXes, and you're done. If you've decided to roll your own Android rendering app, well, good luck. :)
Anyhow, the point is that what you want to do is find a generic solution for rendering animated models on Android, and only then figure out how to get your content out of Maya.
Instead of outputting each individual frame to a separate obj file like spicyweenie suggests, why not export just keyframes to obj files. Implement interpolation in your code in order to fill in the missing frames. If your models are complex, you'll probably want to cache the interpolated models in memory, but at least you don't have to load them all from files too.
Unlike Cody Hatch's answer, I'm interested in this too. This is my theory as to come about animating a model:
Lets say your model has 30 frames. One way would be to export each frame as an individual OBJ model. From there, you can possible make a folder for those 30 OBJs. So now you have 31 files total. If the person hits a button, the trick would be to load each OBJ in order according to the length of time the button (or whatever action) is valid. and if it lasts over 1 second (30 frames), loop back to the beginning.
The only problem with this theory is that it would most-likely be resource and power intensive, not to mention, a space hog if you try to load a lot of things into one scene.