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.
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.
I'm looking for a 'basic' AR SDK that allows me to draw images and 3D shapes around the user (no matter where he is). It would be even better if the SDK includes a simple way to detect interaction with the shapes (something like onClick).
I made a project from scratch on Android but there's still a lot of work to do and I'll need to do the same on iOS after... So that's why I'm looking for an SDK or a similar project (no matter what platform).
I tested Metaio but it's quite expensive and maybe overkill for my purpose because it uses LLA coordinates.
I tested DroidAR on Android but it's only for Android and it looks heavy too (don't need the GPS).
How about Qualcomm's Vuforia? I was able to quickly get a sample project running on it.
EDIT Looks like I was wrong about what it could do. According to this (which is slightly dated, so who knows) Metaio might be your only choice.
i really don't sure what you really want to do ..but if you simply show images or 3d models on camera without any detection you can achieve this very easily i am explaining for Android and you can extend it to ios on same logic.
first approach:
you have to use custom camera of Android in your app,then use any game engine as per your need..i will suggest Jpct-ae or Rajawali
they are very simple to integrate and can be used for 2d images and 3d models.
this tutorial will explains a lot
keep the gl-surafce transparent and you can have model floating in space ...
second approach :
to add some more effect to your AR app you can use sensor values to move model in 3d space as per movement of device..it gives a cool effect.
use first approach and additionally collect sensor values and apply that matrix to gl camera of your game engine..for sensor values follow here
good tutorial here..
i hope this may help you..i done these a long time ago but try to help if you want..
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'm trying my hand at making a platform game and have been thinking about what I would use to design levels.
I was thinking of using a tile palette that would contain the graphic tiles and their properties. And a similar palette that would contain sprites.
This way I could drag and drop tiles/sprites onto a grid and specify property values. This could all be saved to some kind of file that would be read by the game.
Without getting too into the details, is this a sound overall strategy? Is there anything major that I'm forgetting? Or perhaps there's a better method?
This is a rather open-ended question, but I don't think there is anything wrong with your approach. You might have to try a few things to find out what works for you.
When I make platform games I find it useful to be able to edit levels while I'm playing them, by adding in code to the game which allows me to select a graphic tile from a palette and paint it onto the screen. The behaviour is usually linked to the graphic for my games but you could paint behaviour as well. You then need code for your game to save levels as well as load them. Obviously, you would probably want to remove the editor before releasing the game.
I don't know how much experience you have with game dev, but if you're thinking about making a tile-based platform game then your best bet is leveraging existing libraries/tools to avoid "re-inventing the wheel". I highly suggest looking into open source libraries/tools because you can modify them to your liking. I've had some good experience with libgdx and AndEngine in which case both have TMX support which is a file format that can be used in conjunction with Tiled map editor. I personally like libgdx because it has javadoc and very actively developed, and also that it's a framework rather than engine which gives you more flexibility (although more coding in some aspects).