Home Technical Talk

Building that make "holes" in terrain

polycounter lvl 6
Offline / Send Message
dreatern polycounter lvl 6
This is more a curiosity than a need to reproduce

In many strategy games 2D/3D there are buildings with different elevations + and -
when it is below the ground, the building fits perfectly "cutting" the terrain.
how is it done? alpha test?

Anno 2070 example
ano2070cutterrain.jpg

Replies

  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    Games like this are built on a grid, the grid tiles are deleted or hidden and then replaced with the modular piece for that building.
  • dreatern
    Options
    Offline / Send Message
    dreatern polycounter lvl 6
    every piece of the terrain is a tile?
    many games have terrain editor we shape/paint the terrain with brushes without seams, i thought that the grid was only applied to the buildings
  • monster
    Options
    Offline / Send Message
    monster polycounter
    For Halo Wars, when a building was created it would flatten the terrain around it then an alpha decal was projected downward in the shape of the building (if needed.) This created a whole in the terrain. Any terrain visible in the hole was part of the building model.
  • mdeforge
    Options
    Offline / Send Message
    mdeforge polycounter lvl 14
    I take it the grid resolution changes to be more dense when something like a building carves out the terrain then? For terrain like that above, I wouldn't be surprised if there's only 6 to 10 tiles on there. But for that hole to happen, 30 tiles or so inside of that particular tile? Surely the rest of the tiles aren't that dense, or are they?
  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    I could be wrong, but I swear for some editors similar to the starcraft editor it has a wireframe view and it seamed the decales and textures were all set up on a grid that matched the wireframe.
  • Computron
    Options
    Offline / Send Message
    Computron polycounter lvl 7
    UDK's terrain is seamless, and tessalatable, but you can place holes in it.

    The hard part would be to flatten the terrain surrounding the hole to avoid any seams there.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    cut a hole in the terrian than just use a mesh for hte dug out bit.
  • Ark
    Options
    Offline / Send Message
    Ark polycounter lvl 11
    I have the artbook for both 1404 and 2070 games and it looks as if they just model each building on a plane that has a alpha on it that blends with the underlying surface.
  • EarthQuake
    Options
    Offline / Send Message
    if this is always viewed from the same angle(IE no rotating) you can fake the "look" of a recess with an alpha'd texture. This looks a little more convincing than that, so maybe they're doing something more advanced.
  • dreatern
    Options
    Offline / Send Message
    dreatern polycounter lvl 6
    EarthQuake wrote: »
    if this is always viewed from the same angle(IE no rotating) you can fake the "look" of a recess with an alpha'd texture. This looks a little more convincing than that, so maybe they're doing something more advanced.

    In Anno we can camera rotate/move/tilt freely to see all angles.
    Buildings with "terrain subtraction" are very detailed and seem to cut and fit perfectly on the ground, with animations and in some cases water inside it.
    The texture splatting/blend remains even with the building placed on middle of a blend, the texture does not change on the ground around, just a small blend to "fuse" the building with the ground.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    One can render a box slightly hovering over the terrain "invisibly" in a way that it masks pixels that intersect the box in the stencil buffer (similar to stencil shadow algorithm). Then you could clear the depth value of all masked pixels, and render your actual geometry.

    You could also project a texture with those "masked" regions on the terrain and then perform "discard/alpha-test" so that terrain really has holes on the pixel level.
  • ambershee
    Options
    Offline / Send Message
    ambershee polycounter lvl 17
    Looks pretty clear to me; a terrain system with a moderately high resolution triangulation, and they're just not rendering the triangles where the structures sit.

    The structure fits into the grid presented by the terrain quite neatly, hence its shape.
  • Anuxinamoon
    Options
    Offline / Send Message
    Anuxinamoon polycounter lvl 14
    Just taking a stab here but this is how I think it might work. (pardon any bad spelling in this image)

    14l4sy.jpg

    I would say they have 2 types of 'buildings' where most would remove any grid tiles/tris under them and replace them with their own model with an alpha blend.
    The other would be little prop type objects that sit on top of the terrain grid.
  • dreatern
    Options
    Offline / Send Message
    dreatern polycounter lvl 6
    Jump to 1:05 seems some type of alpha test
    This is a grid, but the terrain can be shaped freely raising and lowering
    [ame="http://www.youtube.com/watch?v=nkJVHwFYvZc"]Heroes V Map Editor - YouTube[/ame]
  • ambershee
    Options
    Offline / Send Message
    ambershee polycounter lvl 17
    Anuxinamoon has it - this is what I was getting at but was too lazy to draw pictures :)
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Dude, they answered your question already, Anuxinamoon, went even into details about it.

    Is that not the effect your looking for? The video is showing the exact same effect, everything is interpolating between the vertices of the grid, and the raising and lowering of the ground is a sub-form of tessellation, which even old COD games had to displace water.

    I don't see any 'smooth' displacing or holes, most of the mare pretty clunky, and many more even just are on land without any holes. The video even shows the placement of building being done on grids, with again, vertex interpolating as to where the decal/projection is being set.

    Also, they're only lowering the terrain, since too much of a land stretch can lead to texture stretching, so you might need your own custom solution for that case.

    All of this has to do with engine and what to call what and how to process what. Everything else has already been mentioned and is pretty simple by portfolio standard, let alone simplified version of it in a game.
  • Eric Chadwick
    Options
    Offline / Send Message
    How it's done in Unreal 3
    http://udn.epicgames.com/Three/DevelopmentKitBuildUpgradeNotes.html#Unreal%20Landscape

    In this case, you simply cover the edges with meshes.
  • dreatern
    Options
    Offline / Send Message
    dreatern polycounter lvl 6
    When i posted before, the Anuxinamoon reply had not appeared to me. I'm just seeing right now...
Sign In or Register to comment.