Skip to main content
GameDev.net gamedev.net
🔒 Locked

Best RTS Terrain Blending. How???

Started by cyberlorddan Jun 11, 2010 at 11:44 AM 8 replies 2.9k views
Original Post
cyberlorddan
cyberlorddan
I've just checked the starcraft 2 "galaxy" editor and the terrain texturing is amazing. It's like painting the terrain exactly as you want: you can have smooth transitions between grass and dirt and you can also have hard edges between them.

My question? How it was done??? :D

The most complete method that comes into my mind is probably one of the worst: Real-time painting a giant alphamap that covers all the terrain, then apply the textures - let's say the grass texture - based on the alphamap's value.

Nice idea right? Does anyone have a more resource-friendly one?
mind in a box
mind in a box
I don't know the editor for starcraft2, but I can tell you how it was made in the UE2 and UE3. They do it per vertex, and since their terrain got lots of them, it looks very smooth, too. I think they put a layer index into the vertex or so, not the color.
cyberlorddan
cyberlorddan
It's more precise than that...

It's just like painting an alphamap. You can even choose the shape of the "brush". And it's just like..."pixel accurate".

Using a huge alpha-map would slow that alot, but I get 200 fps, so I'm assuming it's not a huge alpha-map.

Any idea of what could it be?
Koobs
Koobs
Video showing off the editor doing its texture thang (around the 1 minute mark):


My wild-ass-guess is some sort of multi-texturing with some alpha-magic localized to mixed terrain areas on top of a bunch of vertices, like mind in a box said. Note the lag when the guy in the video sets the whole map to one texture; that shouldn't happen with one big alpha map. The video notably lacks examples of mixing more than two textures and mixing two textures on varying height terrain, which makes my guess all the more wild-assier.
JonConley
JonConley
Well in an editor you aren't doing physics, you aren't doing AI, you aren't doing animation, fewer things being rendered. So with large alpha maps or even weights per vertex (say 4-6 channels for texture alpha weights that are passed to the shaders) wouldn't be all that terrible.

When you build the level down to be implemented in the game you combine it all into a mega texture for your terrain so you no longer have to deal with the weights /alphas.
Shanee
Shanee
Quote:
Original post by cyberlorddan
It's more precise than that...

It's just like painting an alphamap. You can even choose the shape of the "brush". And it's just like..."pixel accurate".

Using a huge alpha-map would slow that alot, but I get 200 fps, so I'm assuming it's not a huge alpha-map.

Any idea of what could it be?


It's easy. I have it in my engine and terrain editor, it works in real time without any lag.

It is just an alpha map. If you are worried about the size, just split it to several alpha maps.

My boyfriend uploaded a really old video of the editor (before it had GUI) over a year ago, it shows painting over to alpha map quite early, but you can also just jump to 1:35 or 1:40 to see an example.

">


But warning, the video is from a really old version, no GUI, not even projection of the brush (which can be rectangular/circular). He is doing everything but button press settings he knows.

[Edited by - Shanee on June 12, 2010 4:00:58 AM]
Shanee
Shanee
The way it is done is really fast, we just have an image of a brush and render-to-texture (the alpha blend map) the white brush (black at the places which make its shape) and render it on the alpha map at the current location (according to the terrain) with the right color values (let's say 0,255,0,0 for second texture).

As you can see, the terrain update instantly per frame, and you are rendering per frame.

Our terrain is split into sections (32x32 grids each) and each section has its own blend map.

When done, it's saving the blendmaps with the terrain vertices.

Every blendmap is 1024x1024 (might change it to be lower, 32x32 don't really need that big texture, but it doesn't really matter, performance is just fine too)
TomKQT
TomKQT
Quote:
Original post by Shanee
My boyfriend uploaded a really old video of the editor (before it had GUI) over a year ago, it shows painting over to alpha map quite early, but you can also just jump to 1:35 or 1:40 to see an example.

But warning, the video is from a really old version, no GUI, not even projection of the brush (which can be rectangular/circular). He is doing everything but button press settings he knows.

Where is the video?
Shanee
Shanee
I am sorry! I was sure I linked to it:

">


Edit:
Basically, we have a set of brushes in different shapes, for example a circular brush or a rectangular brush.


And what we do is set which brush to use, maybe scale it and render-to-texture (the blendmap) with the appropriate color values (for example 255,0,0,0 to use the first texture).

Of course what we are actually doing is incrementing the value and *USUALLY* not setting it by a specific value, this is how we get the nice blend result :)

[Edited by - Shanee on June 12, 2010 4:59:02 AM]
cyberlorddan
cyberlorddan
Great ideas.

Thank you everyone! :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.