Highlight around country border for RTS game


I have a small problem regarding Blender’s game engine (at least I thought it was a small problem at first, but after two days of trying and looking around in various forums I’m not so sure anymore).

I’m working on something that’s supposed to become an RTS game someday. I’ve made a world map


where I want to be able to select any country (each country being a seperate object, divided into regions on the vertex level). That country should be highlighted when selected. I am now working on the material for this selection. The highlight should follow the country border and fade to alpha 0 towards the center of the country.
I quickly made up some images in GIMP to better explain my goal, with just two countries.

If I’d select germany, it should look something along the lines of this image


When I select Austria it should look like this


Now, if I were to play as Austria for example, and I’d annex Germany (:evilgrin:), the selection should extend to both countries and look like this (I guess I’d have to join both meshes to achieve this).


I’ve tried everything I could think of (toon and edge shading, transparent material with fresnel, vertex colours, material nodes, some sort of volumetric light, I looked for tutorials regarding materials for holograms or ghosts, even a electron microscope material), but nothing seems to work. Moreover, half of the methods I tried don’t seem to be compatible with the game engine anyway - procedural blend textures for instance. Also, since the whole thing should be quite flexible (any country in the world being able to take over any other country, also not directly connected countries) UV textures are not an option I think. Preferably I’d also like to not add any additional geometry, too, as there’s already enough I think (if not too much).
I think the most promising approach would be to use material nodes, something like in this tutorial:

but for one I think this doesn’t work on flat surfaces (at least not exactly as in the video), and I can’t make the material show up in the game engine either (GLSL enabled).
Any advice would be appreciated (step-by-step instructions at best), I’ve uploaded a blendfile too, if that helps.


Thank you very much in advance!

I just saw you have to enter your mail adress when downloading from this filehosting service. I’ve uploaded the files elsewhere, here are the links.


Edit: Filefactory is not much better, does anybody know a good filehosting service?

Edit: Now!


Just have two versions of each country, have one them spawn every frame for 1 frame,

so when you are “selecting” a country, the object it is adding is the highlighted version

get it?


Selector.blend (502 KB)

Thanks for the quick answer. I’m not sure though if I understood right.
Wouldn’t it look like this then?

Or do you mean I should make additional textures, where parts of the border are deleted, and to use only the texture that’s needed at the moment? That seems a bit complicated to me, it would afford 6 or 7 textures for Austria alone (the number of the neighboring countries) - or even more when I think about it. And if I went further into other countries the number of textures would grow exponentially (let alone oversee areas, that are not directly connected). That’s why I ruled out UV textures. But I probably misunderstood what you meant.
At the moment I’m still struggling to get the border effect in the first place anyway, I’ve not yet put too much thought into how I would extend it over to other territories. But when I get there I’ll sure take a closer look at your file, thanks for that.

no, don’t change textures, change meshes, have the other mesh on another layer

O ic your issue
I thought you were trying to highlight a single nation to “select it”

you need each border as a separate object, so east side -> intersection of next country

peninsulas could have 2 “border objects”
have these alpha mapped and just above the map, so in effect they are “on top” of the map,


I would not use textures, I would use a couple of lines set to wire, that way you can scale it a few times, and have it “blink” or change color etc, and leave the terrain underneath


Xample.blend (541 KB)

Ah, now I see, that could be an idea. However, I’m not sure if I should go that way, it would double the vertex count of my scene (I’d need one circumferential border that can be filled with faces and additionally each segment of the border as a seperate object).

Regarding your idea of not using textures at all, if it’s not doable with textures (and I think UV are unusable in this case, whereas procedural textures are not supported) I have no other choice, but I’m not yet ready to give up :slight_smile:
I think it should be possible somehow to use material nodes to achieve this effect…

what about limiting how much map you can see at once, unless you “zoom” which deletes the countries and only shows the borders? then when you zoom back in they all restore visability?/occlusion

check this out

hit p

hit space


Xample.blend (568 KB)

can you load /unload items from different .blends? have a “name your country.blend” and a series of meshes, and delete the one your going to replace ?

that way you only have loaded what is seen

are objects on another layer considered in scene? I don’t think they are… if you do add object and end object, I don’t think that there are anymore faces in the scene…

Also a good idea :slight_smile: At least I could get rid of the provinces when zoomed out. And the thing about connencting different .blends is also something to investigate further. Until now I succesfully managed to avoid using proxies but that is probably something you should know a little about. You probably notice I’m not very experienced in game making, I’ve worked with blender for some years now but always on non-realtime stuff. I realize making a rts game is a bit ambitious but I think of it as a long-time project, learning by doing. In the worst case I’ll have to discard something or even start over at some point, but will nevertheless have learned things I can apply the second time.
In any case thanks for your input, and also for the blendfile, you already led me to some ideas.

No problem :slight_smile:
I am making a realtime 3d rts fps, and your problem solved some of mine

I am making a mine craft style targeting for snapping “components” together, that are blocks, so I need to have a face turn red myself so…