Large worlds - need guidance.

For the past month I’ve been experimenting and really grinding my way through tons of information and ideas to impliment in my game. I am FAR from putting anything together really. Still working out some rough edges.

I want to have sorted out as much as I can (concepts, characters, scenes, story) before I sit down and start any level building or whatever gaming will be needed .

It’s only a hobby, something I do after work and right now I’m doing it for the love of it, hoping to give something back in the near future.

Okay, to get to the point. Some of my scenes might entail really big landscapes. So instead of entering and exiting scene after scene I’d like a big single terrain loaded (or preloaded at intervals) Or, do I just scale my fps character to a very very small blob and enlarge the terrain…(?!)

Also. I need to know at what unit scale am I suppose to work and where can I set this (cm, m, ft). This will propably depend on the answer from the previous paragraph :wink: Might be a silly question but the more I know beforehand the better my workflow will be when I start.

I’m a bit new to the whole BE (but reasonably well versed in Blender) so I’m still trying to find out what is possible and what not.

Also, just a side question. When you do texture painting (I want to use it for terrain texture), is the UV texture you create turned into a single texture file? Also, is it better (for memory, cpu, resource) to use tiled textures or single UV textures.

Let’s say a tiled PNG texture of 1mb tiled 10x that is 10mb
vs
1 texture that is 10mb. Both should be taking the same amount of memory… yes, no?

This last question kinda fits with the situation of texture painting. If texture painting creates a single UV map and this file is bigger than a tiled version of a texture, I’ll have to find another way to texture large terrains.

Well, thats it. Thanks for reading this!!

:slight_smile:

Blender has no built-in method for dealing with terrain, so unless you want to code some sort of system for loading and unloading data blocks, you pretty much have to make the terrain all one big scene. (but break the ground up into pieces so it can be culled.)

The physics engine in blender, as well as several other mechanisms (I believe) assumes that the scale is 1 Blender Unit=1 meter. For best functionality, I recommend using this scale. Unfortunately, this means that a large terrain will be REALLY huge…

A tiled texture is more memory efficient- a 1mb texture tiled is 1 mb, whereas a 10 mb texture is 10 mb. The engine stores every texture just once, and it can then paste it wherever it wants. If you use texture space, you may as well make the best of it. The advantage of using a larger texture without tiling is that you can make every part different, whereas on a tiled area it’s… Well, it’s tiled. I don’t think I’m explaining this right. XP

I believe that in most games terrain usually has one texture, probably no bigger than 2048x, for general coloration, and as the camera gets closer there are tiled detail maps.
One option the BGE allows is texture splatting; You could make a tiled grass texture, and a tiled dirt texture, at 256x each. Now, on the whole terrain, you use one greyscale image which tells tee BGE how to blend each texture- Where the b/w texture is white, the terrain is all grass, where it’s black it’s all dirt. This lets you basically paint on roads and patches of sand or whatever else.

Hope I helped at least a little : )

I found that using GLSL as used in the Splat demo on the Yo Frankie site really helps making big terrains. Download the blend from the ‘GLSL! Splatting!’ article at http://www.yofrankie.org/?p=192

What you can do is have two tiled textures which you UV as quite small to keep the detail and then use one texture mapped to cover the whole terrain as a stencil which allows you to mix from one to the other. The results look similar to what you can do in Torque with their terrain editor thing and you can just paint it on. On my golf course I used used two different grass textures and had a patchy stencil to blend them… looks rather good I think.

Well, it depends on how big you really want your terrain to be. For epic mapsizes, texturing such a beast efficiently would be the most difficult part. You may want to learn some GLSL code and make a texture splatting script that allows you to blend tiling textures with painted vertex colors. Of course, the RGB values only allow for three textures.

Depending on the size of the environment, you might want to break it into cull-able peices (making them disappear when you get too far away, saving resources).

Also, you could try to use one massive texture (4096x4096 is an acceptable size for modern computers), but this will look blurry if you map is a super-gigantor.

Cull-able pieces??? This seems to be of intrest to me.I never thought Blender had that.

OK- I had an idea for having a city that would be chopped up into segments or areas which would be made visible according to their distance to the active camera using a script. I was wodering if that would work? But I will have to wait until Im done with the essentials of my not so little project…

Well sir, you never thought wrong! It doesn’t!

You’d have to script in your own culling system. You’d basically make a script that sets off objects’ mesh actuators based on distance to the active camera.

I’m no expert or anything, but I think the main problem with large single environments would be poly count. If the terrain is to curve and flow realistically then you would need lots of small polygons, but if there are large flat areas then you would get away with less polys.

Environment detailing such as trees, buildings, wildlife, etc. would all affect the poly count and therefore the performance. Implementing some kind of culling to reduce the polygons as suggested by previous posters is the way to create single large environments. Level of detail (LOD) is a good way… have 2 meshes to represent everything, high poly to be displayed near the player and low poly further away where the detail is not so important (maybe put detailing on the low poly mesh’s texture instead of the model… windows and doors on buildings, leaves on trees etc.). This may also work for the ground. Hills far away would not look so bad made from large polygons, but smaller ones could be used near the player. This would mean you’d need to separate the mesh for the world into sections that could be switched low to high poly as the player gets close to them.

The key thing to remember is that the game engine renders All polygons in the scene, whether they are in line of sight, or not (someone please correct me if I’m wrong). Everything obscured behind other objects is rendered, behind the camera (some kind of octree culling might be able to be used), around the back of objects (back face culling could be used here), out of viewable range (LOD culling). Some good scripting would enable you to increase the size of your scenes massively.

The best thing would be to experiment, and see what you can get away with :).

Edit:
Chaser: Texture splatting is easy in Blender thanks to the Apricot project and the integration of GLSL. Check out the link posted by Larryboy and be amazed at how easy splatting has become. :smiley:

Well sir, you never thought wrong! It doesn’t!
when did that happen? the culling system has been a friend and enemy of mine since I started using the bge many versions ago- on the one hand, performance boosts, on the other, it kept culling objects who’s center was offscreen but was still visible. Unless it was taken out, the BGE certainly has some degree of culling…

[edit] oh, you meant LOD, not culling. Carry on : )

(people tend to confuse clipping, culling, and LOD. culling cuts meshes that are behind or to the sides of the camera, clipping cuts polys that are too far away, and LOD changes detail the farther away the object is)

:eek:

Captain Oblivion: BGE has that kind of culling? I never knew… Would it be possible to have two cameras, one with a very large view frustrum to use for the culling, and another to use for the player’s view? Surely this would at least cut out all objects that were behind the camera…

Edit: Or is it there by default (excuse my misuse of terms, I’m an amateur ;))

I am an amateur too so please dont shoot me down for my use of terms…

I was trying to find a way to use python to get the direction of a normal of a face using the Blender.getMesh() thingi.But found nothing close to “get.Normal()” or something.

So I wondering if there is a way to get the direction of a normal using python-Mayby it can be used for more than back-face culling.

PS:I am still clueless on where to start on learning GLSL

Blender already has back-face culling, but I’m sure there’s a way to get a face’s normal for shaders- after all, that’s how people have been doing toon outlines for some time. There was a tread on this some time back (I don’t knw glsl at all though)
also, for simple shaders you can just use texture nodes now, as 2.48 supports this in-game. You’d still have to learn glsl for more complicated/specific shaders.

I have heared about the backface culling. The real reason for me to getting the normal direction (especialy with python) is to use it for other functions such as…
an AI using a face with a particular meterial (wall or something) that has its normal in the same direction as its enemy according to its pos

@TrueFlection
Have you tried the Mesh.MFace.no() function? the Blender Python API says this should return the face’s normal vector as (x,y,z) vector. I have no idea how you’d find the correct face on the mesh to check for, and it’s part of the Blender module so users would need a full version of Blender to play the game, but it might work… maybe use a seperate mesh with a single face?

I just got myself wondering about this, and started looking about. There are a couple of classes in the game modules that are interesting. The only way to get a normal, I found in the KX_VertexProxy class, which gives the values for vertex normals. I’m not sure how or if this relates to the face normal, but KX_PolyProxy doesn’t mention normals at all.

@FunkyWyrm
Thanks for the directions I`ll look into it as soon as possible.

@FunkyWyrm:

I’m certain that you can not use the Blender Python API in the BGE. The functions in this API are in the blender module, which you can’t use in the BGE. The modules built-in to Blender that you can use are GameLogic, GameKeys, Rasterizer, and PhysicsConstraints.

:D:D:D:D:D I just tested it quick and it work. :D:D:D:D:D

@FunkyWyrm -You ROCK:ba:

Im going to have some more fun playing with the Blender API becuase Im actualy supprised that it worked in real time. Maybe(Actualy hoping:o) that all of the API will work in real time.

@Moguri
It seems that you might be right becuase as an .exe it doesnt run becuase 2.48 doesnt have the blender folder as the older builds but Im trying something rite now …

I’d just like to point out that this is really deviating from Gustav’s original questions, you might want to start your own thread for this discussion…

No problem! Some of it could be helpful in the future, as soon as I am more clued up. The LOD, culling etc. scripting looks quite promising. I will google a bit and see what other people have come up with. My python skills are really weak at the moment :wink: but I might be able to figure something out from it or build it myself in the future - if possible…

That texture splatting stuff from Yo Frankie looks to be pretty amazing. I’ve ordered the game but it’s only going to be here in propably 5 weeks or so - I’m from South Africa. But I’m going to give it a go tonight! Wait… “GLSL code and make a texture splatting script” - Chase…? I have to code this? Haven’t checked the video but it seems the function is built- in.

At least I’ve got clarity on the whole tiled vs UV memory resource consumption thing.

Thanks for the replies everyone. VERY helpful and has definately put me on the right track. :slight_smile:

Sorry there Gustav (fellow South African:rolleyes:).

Something I forgot…
I had once tried to make a city.I started with the roads and decided to make all of the roads one mesh or object.Carnt remember the poly count but what I noticed was the drop in fps.Even used a large terain once that I made back in my days of my “Render” years.pressing ‘P’ was depressing for me.

Hope that was usefull:D

Gustav - Haven’t checked the video but it seems the function is built- in.

Yes it is built in and once you get the hang of it its really easy… Only problem I get is fin myself drawingon one of the textures and not the stencil… get there in the end