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开发者_JAVA技巧 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.
精彩评论