• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

"Terrain Fog" problems

Status
Not open for further replies.
Level 2
Joined
Dec 30, 2008
Messages
9
So I've been messing with terrain fog off and on for a while now and I'm honestly fed up and confused with it now. I did a search for similar problems, but all other topics returned were unsolved and weren't exactly what I was looking for, I think.

I'm trying to make a fog using the terrain fog feature (the weather effects fogs are no good for what I want) that's very dense at ground level and progressively loses opacity up until it fades away a few cliff levels higher up. The closest I've gotten to what I want was setting Z Start to 0 and Z End to about 2000 on the linear setting. This gets the dense levels of fog I want on the "ground zero" terrain. However, the higher up terrain only appears to only have a lighter fog when it's closer to the game camera. (So basically only when it's on the edges of the screen, since the camera will raise to compensate for the terrain the more you move over it, which causes the distance between the camera and terrain to increase, and the fog to darken until it's as dark as it is on the ground.) On a side note, explanations as to how the Exponential 1 and 2 features work would be appreciated, although not necessary. It seems like no matter what I do the fog is either pitch black everywhere or not dark at all.

So yeah, does anyone have a fix for this? I tried showing the desired effect using MS Paint (see attached jpg), but... As you can imagine it didn't end well. I could try to provide a somewhat better photoshop of what I'm trying to accomplish if necessary, but I'd have to go find whatever hard drive I have that program on and swap it with my current, so that may not be possible for a few days.

Also another question that goes hand in hand with that is I was wondering how to create an anti-fog. One that cancels the effect of the terrain fog and provides normal (or at least less obscured) vision of the area. I know this is possible, as it was one of the features of the Flashlight item in Undead Assault 2 back before the recent patch stopped it from being hostable. During the first or second mission on Umbrella mode, a dark fog was placed over the entire map (At least I think it was a fog effect. It suffered from the same problems with terrain height and density that I'm having) and a flashlight would provide a small beacon of light around anyone carrying it that countered the effects of the fog. I'm looking to implement this either as a short term buff spell or as an on-attack effect, but any help on implementation in any form - be it the above or via just a passive item ability - would be met with sincere gratitude.

A preemtive thanks to anyone who can lend insight on either of these problems I'm having. So long as one of them gets fixed I can probably change things around enough to compensate for the unsolved issue, but a solution to both would be ecstatic! Thanks.
 

Attachments

  • terrible mspaint rendition.jpg
    terrible mspaint rendition.jpg
    73.5 KB · Views: 344
Level 2
Joined
Dec 30, 2008
Messages
9
Been over a day and I'm still at my wit's end with this. Shameless bump to front page in hopes that it catches the eye of someone who knows how to solve it.
 
The wanted effect doesn't really work unless your camera is centered on the area where you want it to be exactly like what you want, that'd involve having a lot of fog z end fiddling while having a fixed camera. The fog is always based on values away from the current camera height, etc, and doesn't work with cliff levels like so.
The second thing is that it wasn't a fog effect, it was a 'call setDayNightModels ("","")' effect (input that into a custom script). Using lights of any kind (torch, light model) clears it up.
 
Level 2
Joined
Dec 30, 2008
Messages
9
Wow, thanks for the fast reply! The solution you gave also worked perfectly. :) +rep

This setDayNightModels script wouldn't by any chance happen to be able to be scripted to only effect certain areas, would it? For example, the reason I was trying to use the fog in that way was to have a very dark underground system that was just multiple terrain levels lower than the rest of the map, and to have it sectioned off from the rest via waygate type units. So would I be able to make this trigger so that it only made it dark in the general cave region? Or would I have to do something along the lines of...

  • Lighting
    • Events
      • Unit - A unit enters Underground <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Custom script: call SetDayNightModels ("","")
... and have the SetDayNightModels only apply to Player 1 (If that's even possible. I can barely even understand GUI, as you can see) and have a similar trigger to turn it off when the unit left that region, as well as triggers for the other players? Or would that be too complex and a recipe for disaster?

Regardless, even if that isn't possible, I can make do without it thanks to the initial script. Thanks again! :) Mods can change this to solved if they want.
 
I will give you a temporary solution, since it may cause desync to multiplayer maps.
  • Lighting
  • Events
    • Unit - A unit enters UnderGround <gen>
  • Conditions
  • Actions
    • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
    • Custom script: call SetDayNightModels ("","")
    • Custom script: endif
This effect will apply only to the owning player of the unit.
 
Oh, you'll probably want to know how to turn the lights back on. That's uhh

  • Events
  • Conditions
  • Actions
  • Custom script: call SetDayNightModels( "Environment\\DNC\\DNCAshenvale\\DNCAshenvaleTerrain\\DNCAshenvaleTerrain.mdl", "Environment\\DNC\\DNCAshenvale\\DNCAshenvaleUnit\\DNCAshenvaleUnit.mdl" )
Note that that only works if the map is using ashenvale lighting; you can also set people's lighting to different environments, such as underground, barrens, village, whatever. You'd just need to get the right DNClighting file

edit: oh also, for the singular player- using a variable which is set at the start works easily since you don't need different player handles or functions or whatever the fuck they're called (instead of GetOwningPlayer(GetTriggerUnit()), it'd be '== udg_playerVariable' which was set earlier in the script) -- if i remember right
 
Status
Not open for further replies.
Top