Hi.
I've only just started making the transition from programming 2D games to 3D ones. Now in most 2D games, levels are built from tiles. In some there is simply a background image and a few other images of ground pieces or what have you.
My question is, how do you represent a level in 3D?
Should the whole level be a single model? Should most of the ground be its own model and certain smaller objects be their own model? I'm just wondering what the most common solution is.
Thanks in advance.
P.S.
I know some games use height maps for the ground but I'd need to have overlapping heights for certain sections so this is not a good solution for the moment.
Format for 3D levels
My solution is usually a big mesh for static geometry and a list of entities for everything else (each one with a mesh name or something, so you can reuse the same meshes in different places), works fine
Another option I've done is a tile system in 3D, it makes it easier for collision detection, but you lose lots of flexibilty in other areas.
Another option I've done is a tile system in 3D, it makes it easier for collision detection, but you lose lots of flexibilty in other areas.
Terrain is usually done with a heightmap. Actually pretty much all engines use a heightmap. I don't know what 'overlapping' heights means, but you probably want voxels (C4 engine uses them, that's the only one I can think of available. Pretty cool little engine. Crysis did as well, but I just assume you can't get that one). Typically for overhangs and things like that (on, say, a mountain or cave), separate meshes are used. If you make the terrain one mesh, you're going to have a hard time with occlusion.
I have a small offline app that I wrote that imports basic obj files, plays around with the normals, tangents, verts etc and exports as a binary file. I use assimp (on source forge) for all the loading, it also can split very large meshes into smaller chunks which can be great for occlusion/frustum culling later. Each mesh has its own material most of the time. I dont bother with having a world matrix for my meshes right now and just have the entire level already in world space. For further optimization instancing can be used when a mesh needs to be drawn in more than one place.
Varine, that's interesting; I didn't know voxels were commonly used.
Occlusion means clipping things that are outside the field of view, correct? So how would you deal with, say, an oddly shaped island. Not regular enough to use a heightmap, but simple enough to warrant a single mesh. Now it'll be quite large but not necessarily very high-poly. Is that the kind of thing you would use a single mesh for?
Occlusion means clipping things that are outside the field of view, correct? So how would you deal with, say, an oddly shaped island. Not regular enough to use a heightmap, but simple enough to warrant a single mesh. Now it'll be quite large but not necessarily very high-poly. Is that the kind of thing you would use a single mesh for?
They aren't common. Discluding games like Minecraft, C4 is the only engine I've ever seen that uses voxels for terrain (pretty sure it was one of the first to use them). Crysis used this weird heightmap/voxel combination thing I think, but as I said I assume CryEngine is a bit out of reach. A couple of older games used them for rendering units, but not often.
As WildBoar said, you could divide it up into several pieces (really the issue is how much is being loaded, but that gets really confusing and this isn't the place), and put them together in the engine. Various engines do have occlusion culling, which basically determines what polygons aren't visible from the current view, but if that isn't available then you're going to have to work around it. If you're modelling everything, the best bet would be to do it in smaller pieces. So if the island is a 100,000 polygons, divide it into ten sections of around 10,000 or so, and stitch those together in the engine so it looks like one mesh.
Another issue that might come up is collision, but that's an engine by engine thing. Sometimes collision for meshes is done really weird and inaccurately, so you'll have to watch for that.
As WildBoar said, you could divide it up into several pieces (really the issue is how much is being loaded, but that gets really confusing and this isn't the place), and put them together in the engine. Various engines do have occlusion culling, which basically determines what polygons aren't visible from the current view, but if that isn't available then you're going to have to work around it. If you're modelling everything, the best bet would be to do it in smaller pieces. So if the island is a 100,000 polygons, divide it into ten sections of around 10,000 or so, and stitch those together in the engine so it looks like one mesh.
Another issue that might come up is collision, but that's an engine by engine thing. Sometimes collision for meshes is done really weird and inaccurately, so you'll have to watch for that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement