Creating eclipsing fog for valleys?

Discussion in 'Mapping Questions & Discussion' started by sevin, Jul 25, 2014.

  1. sevin

    aa sevin

    Messages:
    959
    Positive Ratings:
    661
    I'm finally planning a map and want the playing area set on top of a bluff overlooking some valley. I'd like to make it as if the cliff is punching through the clouds so the valley below gets eclipsed more and more by clouds (or a fog). However, I don't want there to be much fog throughout the map, so an env_fog_controller is out. Any ideas?

    EDIT: I suppose I could just use an env_fog_controller and make the whole valley into a 3D skybox?
     
  2. Egan

    aa Egan

    Messages:
    1,304
    Positive Ratings:
    1,486
    You could take some inspiration from Boojum Snark's detail map here, from the 'Unofficial Detail Contest' of 2010. He used layered scrolling cloud textures; if you asked him politely he may be able to lend you a hand, or you can try making some yourself.

    Otherwise, yeah you could try with a fog controller.
     
  3. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    Using several massive layers of translucent materials puts a heavy drain on the engine, I do not recommend it. What you see in that screenshot was a single translucent layer and a single solid "floor" layer, and a gradient overlay on the rocks to fake a thick fog... something that was only doable because of the simplistic nature of it. Wouldn't work for fully developed natural looking valley space.
     
    • Thanks Thanks x 1
  4. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    Upward might also be good inspiration, they use just a fog controller which you can't do a lot of tricks with, but with careful arrangement of terrain features you might be able to fudge something.
     
  5. Limeaide

    Limeaide L2: Junior Member

    Messages:
    98
    Positive Ratings:
    7
    What about the volumetric fog that's used in water? Would that be usable in this situation, or are there some restrictive qualities that keep that from being viable?
     
  6. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,741
    Rexy did something weird for one map, he modified all the material mipmaps so that they'd fade into a fog colour. It was ridiculous, and not a good solution, but it wasn't particularly resource heavy.
     
  7. henke37

    aa henke37

    Messages:
    1,864
    Positive Ratings:
    432
    Uhm, use a material proxy to change the alpha depending on the viewer distance?
     
  8. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    The distance proxy requires the material to be on an entity so it has a reference point.
     
  9. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,741
    Which is why Rexy used mipmaps, they're all automatically done at set distances. Buuuut if anyone has texture resolution at anything other than max, it's all screwy
     
  10. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    935
    Positive Ratings:
    904
    What about secondary/primary fog directions?
    I probably don't even get what the effect is you want. A picture would be nice if possible.
     
  11. Fr0Z3nR

    aa Fr0Z3nR Creator of blackholes & memes. Destroyer of forums

    Messages:
    6,391
    Positive Ratings:
    4,906
    Why not just play with func_dustmoyes or whatever they are? Volumetric, can be made to appear foggish. Wouldn't be a bad start until you could do some proper particle effects?
     
  12. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,216
    Can't you also manipulate that using the texture's internal LOD value or whatever it's called?
     
  13. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    Source doesn't make it easy to make it look good, but I think if you took the advice of other people in the thread and play around with the fog settings on a sky_camera entity you can maybe fudge it enough to get by.

    Use the fog blend settings to do full white when looking down, and match the skybox blue when looking up. Adjust the fog start/end distance to taste. Use a transparent texture for a cloud layer to improve the illusion.. framerate permitting, use more layers. If you need more of a 3d effect maybe you can use a particle system.

    30 minutes got me this, it has a number of problems but it sort of pulls it off and it might work as a place to start. A proper cloud texture would probably help a lot, I just used a bullet decal because it's the best texture available without making my own.

    [​IMG]

    http://xzzy.org/files/games/tf2/test_fog.vmf.gz
     
    • Thanks Thanks x 1
  14. sevin

    aa sevin

    Messages:
    959
    Positive Ratings:
    661
    Thanks for everyone's responses so far!

    xzzy, I really appreciate the test! The beginning of the fog is a very harsh transition, but I'm sure a more graded texture (and time!) would help alleviate that.

    So huge "cloud" textures across the entire bottom of the map would be a bit framerate intensive, I gather. I would of course still want the map to be playable for everyone, so that option doesn't fit. Would big particle systems be more practical? I feel like that would be a lot simpler and more efficient, in addition to some 3D skybox env_fog_controller'ing. Actually making the particle system would be quite a challenge, though.
     
  15. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    You could probably do a single cloud texture without too many issues. Maybe even two. Every single overlay you use in the map is basically doing exactly that if that gives you a sense of scale.

    It's just when you start stacking many of them on top of each other it gets expensive, the game has to do a lot of computation to get each pixel correct.


    A particle system wouldn't be any better, it has to calculate the alpha for every single particle there as well.
     
  16. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    The problem is, as xzzy mentioned, translucent materials in general. Whether it be single large faces or lots of particles. An opaque pixel only needs to be handled "once" (lets ignore shaders and yadda yadda here), and will simply render instead of whatever is behind it. If you have a translucent pixel, it has to be added to whatever is behind it, meaning two things to handle. So on and so forth. If you used 10 cloud sheets to gradually make it foggier, each pixel would have get 11 things blended together.

    A particle system with large overlapping sprites would suffer the same way. That's the reason you could make an extremely crazy sparking sprite (like a saw cutting metal) and it wouldn't hurt the framerate at all because the sprites are tiny and will rarely overlap each other. Whereas if something like the payload explosion smoke starts to fill too much screenspace it can cause a slowdown because the sprites are huge.

    On top of all this... if it gets put in the 3D skybox it will be rendered at all times, because that's just how skybox is.


    Now for an actual idea I just had... you might be able to get something that looks pretty good if you hand-draw the clouds to match your map. That is, make one single large (2048^2 or more) non-tiling texture that you would scale up huge and the clouds would "fit" in your valley, and fade out before they reach the hillsides so you don't see a line where the face cuts through.
     
  17. henke37

    aa henke37

    Messages:
    1,864
    Positive Ratings:
    432
    I think the engine has a limit on how many transparent layers are considered for each point. But yeah, it's fairly high and the overdraw is going to be expensive. I wonder if the real problem there isn't the drawing itself, but the sorting before. The engine sorts all transparent faces before rendering to get the correct result. Sorting isn't known to be fast, but eleven items? That should be trivial. If the sort criteria is trivial. But it's the view distance, or something. I don't know how much that costs to compute.
     
  18. takabuschik

    aa takabuschik

    Messages:
    660
    Positive Ratings:
    308
    Maybe use the Frontier method?
    [​IMG]
    In this pic, the fog is to the right of the metal building on top of the leftside cliffs
    [​IMG]
    In this pic, the fog is right above the tree cards under the conveinor
    I have no idea what it is since I didn't check it, but you can get the decompiled version and look through it
     
  19. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    935
    Positive Ratings:
    904
    A Displacement with a white and a transparent material, as well as a cloud-ish blend modulate might help.
     
  20. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    I actually tried that when I made my thingy that was posted up there, displacements don't play nice with translucent blending.