On terrain creation...

I don’t know if this is the right place to ask this, but as do I need it for the game engine, I believe it’s ok.
What I’m looking for is the most efficient way of level creation for an FPS (singleplayer MMS). It sounds easy enough, but once I gave it a try I felt utterly confused as to what method I should use. So I came here looking for an advice, alongside any helpful tips regarding terrain creation for the BGE.

For instance, how big should it be?
Do I need to follow the 1BLU = 1m rule, or is that relative? - especially as I’ve found it quite hard to work with objects/areas as small as that.

Next, what is the optimal resolution for the terrain texture?
I’ve found it quite confusing at times, as texture resolution does affect framerate (and I’d like my game to be playable on computers with rather low-end visual cards). How much is ok; good; and too big?
Would you recommend one giant plane with a huge texture, or smaller slopes of land put close to each other (especially for uneven terrain)?

And is there a way to paint textures directly (like in Unity), or do I have to create the full texture in Photoshop and import it as a final version?
Speaking of… does the terrain itself need normal and spec maps, or is that an overkill?

I believe these are not the only questions I have about terrain creation, but it is the majority of them.
Thanks :slight_smile:

Look at the new LOD system

Kupoman is working on,

You can use many small items, with MANY levels of detail, that way it only loads high res, high quality when your camera is close to a object… :smiley:

So the answer is NO…


there is no limit to what you can do if your tricky enough…

Low end machine? ramp down the highest possible level of detail, or adjust the distances…


I am currently working on establishing a workflow for creating game environments in blender. Here’s my current system:

Model the basic terrain:

  • Sculpt, use ANT landscape generator, import an object, get a model however you like.
  • The scale system you use doesn’t matter, so long as it is consistent.

Texture the basic terrain:

  • 512x512 images that tile and are blended together using a mask texture.
  • Bake AO and lighting to vertex colours

Populate the terrain:

  • Create group instances for trees, rocks, buildings etc. I link these in from external files.
  • Add spawn-points/other interactive items.

You seem to be asking mainly about texturing, so I’ll outline the system I use.
I use GLSL nodes, and a mask image to blend textures together. I’ll take my current landscape as an example:
This is the fully textured island (minus trees buildings and so on). It weighs in at 12,000 Faces and a 9 mb file (most of which is the geometry). A little high really, and it can be reduced to ~6000 with no loss of detail (decimate modifier to remove unnecessary geometry. I just haven’t done it yet).

The texture (for the land) is made up if 4 layers:

  • Soil
  • Rock
  • Sand
  • Grass
    These images are tiles ~25 times across the island, but it is not obvious

These are combined based on a ‘mask’ image:

Blue is sand, green is grass, red is rock and black (or darker) is soil.

They are combined using material nodes. I use the following setup for this file:

If you look at that image you can see that I extract the RGB data from the mask file, and then use it to mix together the different layers.

If you’d like a copy of the file to play with, I can upload it for you. But really, you’d learn more if you tried doing it yourself!
And I’ve just thought of a better way of doing this… (so that you can get bump and spec maps for all the textures).

Obviously this system does not include LOD, which could be achieved buy some clever system I’m sure. But I don’t think it’s worth it for a small landscape like this, after all it runs at 60FPS on my laptop, using 30% of a single core. This leaves plenty of processing power for AI, characters and other placeables.

Laptop specs for reference:

  • 8gb ram
  • quad core 2.6ghz
  • Dual graphics system, testing is done using an Intel HD Graphics 4000

Wow I have never used Materialnodes before, this should be placed in in the Tutorial Section.

Kupoman’s LOD system is amazing. I’ll give it a try, although my environments won’t be exactly big. I’m going for an early MMS style, rather than huge, open landscapes - but yes, that is really helpful.

@ sdfgeoff: wow, I didn’t know you could use nodes for the BGE - I guess I’ll have to pay more attention to the system, as I have no idea how they really work. And how did you make the mask image - by hand or filter, BL or another program? - and is there a downside to it?
As for AO and lighting… in Unity, lightmaps were baked after the terrain was populated - so is it a better idea to bake after I have my scene set up?

Thanks :smiley:

Yup, material nodes work in the game engine (thank goodness, because I suck at other texturing methods).

I created the mask by using texture paint. Just like there’s object mode, edit mode and sculpt mode, there’s also texture paint mode.
I started with a green image (because most of the island is grass), and then painted by hand on the other colors. By using a textured brush, I got a bit more detail.

There is a downside to this method, the mask image must be quite large. That island is 1024x1024 and it provides enough detail. But for bigger environments, you’ll need to find some way to split the image up. I tried using two vertex colour layers, but for some reason they worked fine in the viewport but mucked up in the game engine. I may spend some more time on this method, because it would allow you to do whatever size map you liked without even needing a mask image. Bear in mind that if you created a single texture for the whole thing (textures and everything) it would need to be even bigger (that island is the equivalent of a 12800x12800 image)

As for baking lights, I only bake them to vertex colours, which gives them a very course resolution (a colour per vertex). Objects are generally too small to influence these baked shadows, so they are only for things like one mountain on another or slightly darker in the valleys (using ambient occlusion) etc. But it is still a good idea to wait until the level is at least mostly populated.

Note that you can use whatever scale you want, but Bullet will use the 1 BU = 1 M scale. If you aren’t going to have dynamic objects rolling around on your terrain, or you’re going to handle the physics yourself, then the scale doesn’t really matter. Otherwise, you should try to adhere to Bullet’s scale.

I did the texture paint thing and it works fine; but I can’t beat the feeling of playing an extremely old title unless there’s a ton of geometry. I populated the scene with grass and wildflowers (planes with textures) and while it does look better, I have 10000 vertices in only 4 BLUs. Any chance of avoiding the high polycount while maintaining a decent LOD? I tried deleting some of the grass, but it didn’t work as well as I’d hoped - as the polycount remained rather high, yet the level lost its original quality.
Speaking of… how high should a level’s polycount be once the terrain is populated?
Thanks :slight_smile:

You’re making a game here, the polycount can be whatever you like. There are no restrictions except for your computer.
Try applying the decimate modifier, set to ‘Planar’ and ~5 degrees or so. For landscapes th’s halves the poly-count without much loss in detaill.

And to give the illusion of detail, it’s better to use normal/bump maps than tonnes of geometry.

Look, I know how to bake normal maps, ok? Idk if I came off as an absolute beginner, but I’m not… I am also aware of the decimate modifier…
I didn’t mean geometry of the terrain itself… This is what I’m talking about:


Nope, I can hear you’re not a beginner, just checking you knew the easy stuff first.

As you’ve said, the problem is that the grass looks like a bunch of flat planes. The easy way to solve it: Make them not flat.
Try making the planes/shapes different sizes or with bends in them. Probably if you have 10-20 different shapes for grass (I see you have some different types, now for some different shapes) it will look a little better.

Recently in the Finished Games forum there was a demo someone did that has some great foliage. There’s also an article on a system someone uses over at this blog (and a video of it in action).

You could also look into writing a shader for grass, There are a couple dotted around the place, but I don’t have any experience with shaders.

You could merge/split the grass into decent-sized patches, and then hide the far away patches using python or logic bricks (visibility actuator). When set invisible, they won’t be rendered. As for reducing the poly count of the grass itself, you could try using longer, intersecting planes with a horizontally tiled grass textures. I’ve used this method and it works pretty well.

Also take a look at benj’s Terrain LOD script that handles terrain and grass efficiently:

The setup for it is complicated, though.

Thanks for your help. Playing around with different combos gave me the result I wanted, with only 13000 verts at 16 BLUs - which could have an even better ratio with some tweaks :smiley:

As for reducing the poly count of the grass itself, you could try using longer, intersecting planes with a horizontally tiled grass textures

The idea had crossed my mind on multiple occasions, but I knew it wouldn’t work on its own (as the grass would have no randomness). What worked best was a combination of that and

Try making the planes/shapes different sizes or with bends in them

I used horizontally tiled textures as the main ‘populating force’ and different sized strands to add randomness. There is one problem though…
I get constant texture popping for no apparent reason - and it doesn’t happen exclusively with the grass, as everything seems to be popping in and out of existence as the character moves - even the ground beneath his feet. Here’s an example of the same piece of land, taken from slightly different perspectives:

Believe it or not, this is the same piece of land

I have no idea why things would be popping like that, other than the usual culprits like incorrect normals and the gras material not being set to two-sided mode (but neither of those seems to be the case here). If you’re willing to upload the .blend, I’ll take a look at it.

Delta Force Xtreme foliage are nice too… look at bended blade on single plane.

Check things like:

  1. Maximum Clipping distance on camera isn’t set TOO FAR. If the value is too high it can cause z-sorting issues
  2. You haven’t run out of video ram (unlikely) (for me this causes some textures to duplicate, but may appear differently on someone elses computer
  3. For some reason, in GLSL mode, the ‘add’ type transparency causes some issues with unrelated objects (like objects with no transparent component change transparency depending on whether an add-object-enabled object is currently visible.
  4. Try toggling ‘face textures’ and ‘face textures alpha.’ on all the materials. This sometimes solves some issues. (or did for me in multitexture mode back in blender 2.57)

@ sdfgeoff: face textures and face textures alpha did nothing for me. The other three are not the problem in my case.

I partially solved the texture popping by joining all particles as one object. There’s no texture popping now, but I can’t hide the far away patches, as they’re all the same object. I believe this will contribute to a low fps later on, when I double the terrain and populate it with things other than grass. Either way, I’ll find a way around it once (and if) it happens.
Still though, what was causing the texture popping while they were all different objects? Any ideas?

In further discussion in PM’s a few months ago this problem was solved. I’m posting the solution here just incase anyone has the same issue.

It turned out that all of the grass planes were occluder objects. Simply setting them to no-collision fixed the grass popping