Units appearing progressively when entering line of sight

Discussion in 'Mod Discussions' started by xedi, June 15, 2013.

  1. xedi

    xedi Active Member

    Messages:
    135
    Likes Received:
    31
    I made a mockup:

    [​IMG]

    Does anyone know how to make this happen? rcix?
  2. RCIX

    RCIX Member

    Messages:
    664
    Likes Received:
    16
    Re: Units appearing progressively when entering line of sigh

    Totally doable.


    ...Not now. Need access to data that shaders don't yet. Not sure what data youd need, but yeah. Would probably need some sort of intel visibility field passed to the unit shader expressed as a texture of size equivalent to the model bounding box XY and filled with data about what areas are visible.
  3. veta

    veta Active Member

    Messages:
    1,256
    Likes Received:
    11
    Re: Units appearing progressively when entering line of sigh

    yup, it'd be nice if this is how it worked normally
  4. thefreemon

    thefreemon Member

    Messages:
    57
    Likes Received:
    8
    Re: Units appearing progressively when entering line of sigh

    Bumping because it looks like a very good idea!
  5. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    Re: Units appearing progressively when entering line of sigh

    Cool idea. Probably doable too.
  6. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Re: Units appearing progressively when entering line of sigh

    I wanted to do that kind of effect for the build shader and eventually scrapped it. Here are the problems I encountered.

    First issue is when you cut a mesh in half with a shader it looks great ... as long as you don't look at the hole. We render our units with backface culling on, so if you look "inside" a unit there's just nothing but empty space.
    [​IMG]
    Now, this can be solved by turning off backface culling on units that are being cut and rendering all interior faces with a flat unlit color, so that's solvable, but it requires the cut edge and interior be a solid color without any shading to not be noticeable. However that also fails if the geometry intersects with something else (like large buildings and the ground).

    The other issue, and this is the bigger one, fog of war is a post process.

    What that means is we don't know where fog of war is on the client until after we've rendered the entire scene already. We can't cut the units in half when we render fog of war because we've already rendered them whole. Now we could calculate the fog of war before rendering, but we'd have store it in a high resolution 3d texture which is extremely expensive (both memory and performance wise) or approximate the best sphere overlap or straight edge to try to match what can be an extremely complex overlapping of many different vision spheres.


    The other thought I had was cutting a unit so you can only see the edge that's in fog of war gives modders an advantage. Since they could modify the shader to just render the full unit if they get the edge of a unit or building they see the entire thing and can easily recognize what it is. Someone playing an unmodified game just gets a colored box edge. Perhaps it's irrelevant in the scale of this game, but it still makes me uncomfortable to spend the possibly excessive time required to implement a "minor" feature that in the end may be exploitable.
  7. xedi

    xedi Active Member

    Messages:
    135
    Likes Received:
    31
    Re: Units appearing progressively when entering line of sigh

    Thanks for the detailed response, makes a lot of sense.

    I'll keep thinking about possible ways to not have units appear instantly from the fog of war, I've always disliked that. It does seem that pretty much any solution will be exploitable, though, but I don't think that's a big issue. Modification of the basic unit and planet shaders is already "exploitable", and I'd expect that certain modifications would be disallowed for competitive (ranked) matches; only allowing UI mods of sorts etc.


    By the way: would it be possible to modify the distance field used for the FOW calculations to also account for some temporal parameter, without it having too big a performance impact or memory footprint? So that areas that haven't been explored in a while get progressively darker. I think it would help a lot in visualising where has been recently scouted on the planet, etc.
  8. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Re: Units appearing progressively when entering line of sigh

    The distance field currently used is re-generated every frame and not stored at all. It's per-pixel accurate to the image on screen. If we want to store that data for progressive fog of war that's something we would have to implement in a different way than it currently is. I'm not sure if we have plans on doing that though, that's a question for Scathis or Mavor.
  9. naugrim

    naugrim New Member

    Messages:
    3
    Likes Received:
    0
    Re: Units appearing progressively when entering line of sigh

    Maybe you could compromise and make units appear progressively but regardless of line of sight?
    So instead of just popping into existence (which always bugged me in SupCom) they'd appear over (a short) time.
  10. veta

    veta Active Member

    Messages:
    1,256
    Likes Received:
    11
    Re: Units appearing progressively when entering line of sigh

    do you mean revealing units in a reveal animation similar to OP, instead of popping into existance? if so that's not a bad workaround, presumably an entire unit would be "revealed" once enough of it enters LOS.
  11. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    Re: Units appearing progressively when entering line of sigh

    Yeah I was just thinking of it more as an animation instead of just popping in/out. Not having to be perfectly accurate with the real border of vision. Effectively just an animation transition on the visibility curve at time t.
  12. GoodOak

    GoodOak Active Member

    Messages:
    323
    Likes Received:
    244
    Re: Units appearing progressively when entering line of sigh

    This is a cool idea. It looks very robo-vision.

Share This Page