terra-firma

posted in A Keyboard and the Truth for project 96 Mill
Published December 29, 2005
Advertisement
As I stated, my trip to 3D was not a total loss. It introduced me to the concept of 'splatting'; splatting is a technique used to efficantly texture a terrain.

I've adopted this method for use in our 2D game. Since we are using a 3D api I hypothosize this will be a far more performant way to draw our terrain, instead of emmulating how it would be done in a 2D api (draw diamond shaped graphical tiles).

here is a picture to illustrate =)



one thing to keep in mind, a 'tile' in morning's wrath, was dimensionally, about the foot-space of one person.

however in this case a tile will be able to fit about 4x4 (16) people on a single tile.

on each tile a base texture is used, in some cases an entire map will use this same texture on all tiles, but in most cases it will vary, regionally.

in this case, all color textures are 256x256 @ 24bits (no alpha channel) since they dont need it and this helps to reduce memory overhead.

these textures are also Atlased, depending on hardware an atlast can hold 1 to 16 color textures, this is done by packing them together onto a single surface and address them through UV coords. Atlasing is important because it can improve batching, if you must render 16 tiles, each with different base textures, you can render them all with a single SetTexture call; if they were all sepreate textures, you would need to call SetTexture for each of them. Atlasing with a known texture size is rather easy, and atlases can manage their dimensions by examing card capabilities and desired maximums.

so once you have your base textures down, your terrain likely looks very good already.

what it lacks is the ability to carve out paths, put down feilds of grass, pools of water, you name it; traditionally this was done via tile-sets and overlay sets, and unless done properly it can look really bad, plus it requires large amounts of image data; AND it doesn't lend itself all that well to the way 3D likes to do things.

So, if we wanted to put a path on this tile, we would add a 'splat' you can think of a splat as a layer (like in photoshop for instance) that is on top of your base texture.

Each splat has a reference to a texture [256x256x24] and a custom alpha map [32x32x8].

You may note the alpha map is very small compared to the texture, this is okay, since it is stretched over the entire tile, and via interpolation turns out to look very smooth, which is what you want in an alpha blend.

Keep in mind, alpha maps are also atlased, since they are small you can fit 16 to 1024 of them in a single atlas. This will help to speed things up.

So, each splat uses a color texture and a small alpha map, and it draws the texture using the alpha map's translucency, and voila you get your highly detailed terrain texture, clipped with the low resolution (but smooth) alpha map, a perfect system to draw paths with.

So if we had a 50x50 tile map, and we used custom images for all of them, we would be looking at

50*50*256*256*3 = ~468MB (holy cow!)

But if we use splating, we only use memory for a bunch of color textures, lets say 20

20*256*256*3 = 3.75MB (Pretty good!)

And then the cost of alpha maps, let us assume that each tile uses a single splat (unlikely, but it will account for tiles that use multiple ones)

then that is

50*50*32*32*1 = 2.44MB (Not bad at all!)

So, splatting would gives us a nice system, with a bit less flexibility, but at a much lighter memory cost.


I've yet to implement it, but it sounds like the method for me! =)
0 likes 8 comments

Comments

Laz
Quote:Laz, seems every time you post you always have somthing bad to say, do you not like me or somthing? (this isnt about copying your style sheet way back when is it ROFL?) Last time I checked I didn't have a grudge against you, but you always seems when you post it is negative.


I'm a cynical bastard (one of my better qualities), what can I say?

And no, I got over that stylesheet thing once you replied to me explaining the situation.

So to keep this on topic, I don't know what splatting is so I have nothing negative to say, sorry ;) But I will say this...

mashed potatoes.
December 29, 2005 01:02 PM
Bradsco
Honestly I think Laz just points out things that some people are thinking, but don't post for fear of their arbitrary forum rating points taking a dive. For instance not long ago I voiced my opinion on Morning's Wrath and sure enough I took a dip.

The point being that most of the time there's interesting stuff coming out of this journal and/or your posts. But there's also an overbearing or possibly overcompensating nature to make things seem more important than they really are.

Don't get me wrong Raymond, I think you're on the right track and I applaud you for all your efforts to work independently and complete projects. But don't expect everyone be fawning over you because shrinkwrapped a couple DVD cases for Morning's Wrath. I for one don't think that's an actual selling point for a product.
December 29, 2005 01:22 PM
TANSTAAFL
Quote:however in this case a tile will be able to fit about 4x4 (12) people on a single tile.


4*4!=12
December 29, 2005 01:55 PM
EDI
Tanstaafl:

great scott, your right!


Schmedly & Laz:

Understandable, though all I can say is there has been a marked increase in certain people taking every chance to fillet me on the spot (not just laz).

I post here for four reasons:

1. What I learn and explain may help other indies.
2. It helps me get my ideas out and well developed.
3. It makes people aware of our games
4. I like that there are people who look up to me and praise my efforts. (of course, who wouldn't)

Lately #4 has flipped around (seemingly ever since MW has been done) on many of my posts I've got a slew of people bitching.

And you might have noticed this has stifled my posting a bit.

It would not be so bad if it had always been this way, but now it just seems like people are pissed at me.

If that is the case it will likely continue, and if it does I'm just going to leave and find another community =/

Only a fool stays where he is not wanted, right?
December 29, 2005 02:30 PM
Pouya
Quote:by TAN
4*4!=12

He said about 4x4 people. He meant that in a very loose way [grin]
December 29, 2005 02:33 PM
Mushu
2 * 2 = 2 + 2 = 5

4 = 2 * 2 = 5

:. 4 * 4 = 5 * 5 = 25.

QED.

edit: holy crap! this is too hot a topic for slow little me :(
December 29, 2005 02:34 PM
Laz
Raymond, no one will ever be at a place where 100% of everyone likes them.

No one said anything about not liking you. I comment on the things that I feel need to be commented on. If I completely agree with something you're doing, then cool. But if you post something that I have a varying opinion on, I'm going to voice my opinion. I'm a very opinionated person. Welcome to life, Raymond, people are like this and will be like this no matter where you go. Don't leave some place just because of the quarrels you think people have with you.

Would you like me to start commenting every time you say something I agree with and say "Right. I agree."

If you post something that looks magnificent, I will comment and say so. Lately all I've done is questioned your method of going about certain things and it has never been a personal hit against you.

Look at other people's journals that I comment in. Yasena is a good example. I've made very few comments in his journal. Most of which are along the lines of "How is this more than just a tech demo?" and "How feasable is something like this, with all the things you're doing on a per-frame basis?" He didn't take it as a personal attack. That's just how I am. That's just how some people are. Again, it will happen no matter where you go.

I have never seen anyone here personally attack you.
December 29, 2005 02:59 PM
HopeDagger
Seconded. I've been reading your journal for quite a while, and people have been pretty darn supportive. Sure the event will occur whereas people will disagree with your means, but critisizm (even the non-constructive sort :P) is all part of developing a game. I'm sure you already know that, but sometimes I find it clicks in more when somebody else says it to me. ;)

Keep up the great work!
December 29, 2005 03:47 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement