Thread: [Tutorial] Env_fog with visible sky

Results 1 to 7 of 7
  1. #1
    Super moderator Hezus's Avatar
    Join Date
    Aug 2001
    Location
    The Netherlands
    Posts
    9,022

    [Tutorial] Env_fog with visible sky

    I was testing some other stuff and suprisingly I achieved an affect I didn't know was possible, so I thought I'd share it here!

    So, this is the level without fog and with fog.


    The env_fog has a certain start and end distance. In this case 512 and 2048. Between those values it will generate a gradient overlay effect from 0 to 100%. However, it doesn't stop after reaching 2048. It will continue rendering that 100% fog thickness from 2048 all the way up to the maximum view distance (which is 160000 in SC). And therefore always completely block out the skybox.

    In reality fog is almost never thick enough to block out all of the sky, so here's a trick to get the skybox back: You can cancel out the undesired effect by lowering the view distance. This is done with the cvar "sv_zmax". You can only alter this on load up, so add this line to your CFG: sv_zmax 4096


    As you can see, the skybox is starting to become visible again. You can improve the visuals by increasing the end distance for the env_fog. Here is value 3000.


    Since this is a bit of an exploit, it has some limitations:
    - The lowest sv_zmax value is 4096. For the sky to become slightly visible you'd need at least a difference of 2048 units between the sv_max value and the end value of your env_fog.
    - Because of the previous limitation, the end value of the fog can't be lower than 2048. If you're making a small area where you need thick fog, this trick won't work very well.
    - sv_zmax will also stop rendering brushes and entities beyond its limit, so make sure you set it high enough, so your entire area is visible.
    - It seems sv_zmax overwrites the worldspawns' MaxRange, so you can't use it to work-around this problem.

    Hopefully this has been useful to someone!

  2. #2
    trigger_delay & func_lazy TrEmPlEr's Avatar  
    Artist
    Join Date
    Jul 2002
    Location
    Valve Hammer Editor 3.5 beta
    Posts
    2,279

    Re: [Tutorial] Env_fog with visible sky

    it is!, Good job! an example map would be cool.

    here
    Modstatus: Unknown

  3. #3
    QPU-aligned Silencer's Avatar  
    Contributor
    Join Date
    May 2006
    Posts
    6,078

    Re: [Tutorial] Env_fog with visible sky

    I think the reason the default behavior feels so wrong in the first place is that fog usually only extends up to a couple dozen meters high above the ground, whereas GoldSource simulates it all the way up into space.

    Neat trick!

  4. #4
    Advanced Leveldesigner SourceSkyBoxer's Avatar
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    803

    Re: [Tutorial] Env_fog with visible sky

    Old tutorial - I already made map with fog since before release new version of Sven Coop 5.x - Why do you not read my old example of Vluzacn's Map Compile Tools - You remember -/+16k and -/+32k. Yes I know engine limitation.
    Hello guys, Svencoop. I am sorry Please respect me! I am deaf. Thanks, Sven-Coop Forum!

    Please do not share to shit dropbox! Please share only Mega.nz!
    Muhahaha, Facebook crashed!

  5. #5
    Super moderator Hezus's Avatar
    Join Date
    Aug 2001
    Location
    The Netherlands
    Posts
    9,022

    Re: [Tutorial] Env_fog with visible sky

    Quote Originally Posted by SourceSkyBoxer View Post
    Old tutorial - I already made map with fog since before release new version of Sven Coop 5.x
    I know fog was available before 5.0 but I havn't seen an example with a visible sky. Can you show me how you did that?

  6. #6
    Advanced Leveldesigner SourceSkyBoxer's Avatar
    Join Date
    Apr 2011
    Location
    Germany
    Posts
    803

    Re: [Tutorial] Env_fog with visible sky

    @Hezus, sorry I loose pictures and files but thread is here. I explain again. I have created map and I add simple hallway -/+30072 and add fog. It looks so close your thread.

    Now engine limitation can not make more than -/+16k if you see black hole of distance. I really miss old version of Sven Coop 4.8 with -/+ 30k.

    Sorry I have not steam now.
    Hello guys, Svencoop. I am sorry Please respect me! I am deaf. Thanks, Sven-Coop Forum!

    Please do not share to shit dropbox! Please share only Mega.nz!
    Muhahaha, Facebook crashed!

  7. #7
    Super moderator Hezus's Avatar
    Join Date
    Aug 2001
    Location
    The Netherlands
    Posts
    9,022

    Re: [Tutorial] Env_fog with visible sky

    Read that thread, but couldn't quite figure out what your example would look like.

    Come to think of it, it would be great if someone could redo the env_fog code and add a max transparancy amount to it. Then you could easily adjust the thickness of the fog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •