Jump to content
The Dark Mod Forums

Suggestions For A Smooth Fading Fog?


SneaksieDave

Recommended Posts

I'm wondering if Gildoran or OrbWeaver (or anyone else of course) might have an idea here. I'd like to (if possible) create a smooth fading fog, so that a level can have transitions from no fog (indoors) to full fog (outdoors), without the ugly seam that appears when doing it with existing fogs. I attempted the obvious - using a light texture which fades gently toward the edges - however this seemed to have no effect on the fog or how it acts at the edges. Any idea why, or how to achieve this, or if it's completely impossible?

Link to comment
Share on other sites

Yeah, the default D3 fog looks kind of ugly... for nicer looking fog, I might recommend using a blendlight. However, that doesn't help with transitions. :( I'd say it's either impossible or hard to do with the D3 engine, though it might be possible to do some tricks to make it seem like you have transitions.

 

I've had an idea for a map with some misty ruins, and a deep gaping hole in the ground leading down into some fogless chambers. I planned on doing the transition by adjusting the blendlight fog in intensity as the player based on the player's Z-position in the hole. (I've done similar things to adjust the brightness of fog in water based on a player's Z-position, so that water appears darker the deeper you go)

 

Then again, that doesn't sound like what you want to achieve. I do have one idea by using overlapping blendlights (one to determine fog intensity, and the other to implement distance fog, the first one setting the alpha channel for the second to use), but I'm not sure it would work well, or even at all.

Link to comment
Share on other sites

I'm of the opinion that foglights are buggy in numerous ways... for example, they don't have the proper density if you're looking down at them. Also, triangles that intersect with foglights can end up with sections of the triangle getting fogged twice (once by the fog shader, and the other by the transparent fog plane at the boundary :( )

Link to comment
Share on other sites

I've had an idea for a map with some misty ruins, and a deep gaping hole in the ground leading down into some fogless chambers. I planned on doing the transition by adjusting the blendlight fog in intensity as the player based on the player's Z-position in the hole. (I've done similar things to adjust the brightness of fog in water based on a player's Z-position, so that water appears darker the deeper you go)

 

Vertical falloff works OK if you use the texture "pitfog_to_black". This suggests that it should be possible to have a fog which falls off in any direction, not just vertical, but even looking at the MTR I couldn't really understand what pitfog_to_black is doing.

 

The other alternative is to bind a very large foglight to the player's position, and script it so that the intensity is modified when the player enters/exits certain areas. This is more or less how Thief did it (except that it was done by the engine, not by the mapper explicitly placing a light).

Link to comment
Share on other sites

It looks like the reason it behaves differently is because it's using a falloff image. In lights and fogs, a stage defines the x/y axies, and the falloff image defines the z-axis... (of course, a light can have its axies rotated) Unfortunately, I'm not exactly sure how it combines the falloff and cross-section to yield the color at a specfici point... perhaps it multiplies the colors together?

 

Hmm... It just occured to me that it might be possible to use clamping to fix the problem with fogging at the edge of fog-lights. I'll have to try it and see how it goes.

Link to comment
Share on other sites

It looks like the reason it behaves differently is because it's using a falloff image. In lights and fogs, a stage defines the x/y axies, and the falloff image defines the z-axis... (of course, a light can have its axies rotated) Unfortunately, I'm not exactly sure how it combines the falloff and cross-section to yield the color at a specfici point... perhaps it multiplies the colors together?

 

I presume it does a multiplication for ordinary lights, but foglights are different. They are not actually lights as such, I believe they just blend their colour with the remote surface based on the distance between the player and that surface. I am not quite sure how the falloff images fit into this, certainly in my tests I was unable to make a foglight use biground1.tga to create circular fog, for instance.

Link to comment
Share on other sites

It just occured to me that it might be possible to use clamping to fix the problem with fogging at the edge of fog-lights. I'll have to try it and see how it goes.

Any luck? The fogs I was playing with had that zeroclamp setting, so I'm not sure that will help.

 

I am not quite sure how the falloff images fit into this, certainly in my tests I was unable to make a foglight use biground1.tga to create circular fog, for instance.

Yep, that's exactly the same thing I did. :( Between that and a full white texture like that used for ambient no fall off, there was no noticeable difference. Which makes no sense, unless it just has nothing to do with it.

 

I also tried varying levels of fogs within each other to fudge a "transition", and well... you can probably guess how that looked. *vomit*

Link to comment
Share on other sites

I was actually thinking about this sneaksie and came up with a relatively bad solution:

 

*make the map first (of course) then get the exact outline of where you want the fog to go and create a large image (2048x2048?) that has the transitions you want. Use this as your lighttexture etc.

 

The only other solution I have is to use the bind light at map start thingy. Though that means the fog is always with you.

Link to comment
Share on other sites

*make the map first (of course) then get the exact outline of where you want the fog to go and create a large image (2048x2048?) that has the transitions you want. Use this as your lighttexture etc.

 

If the fog doesn't obey the light texture (which it seems not to), this won't work.

 

The only other solution I have is to use the bind light at map start thingy. Though that means the fog is always with you.

 

Yes, but you can script the light to change intensity, colour or fog density (shaderParm 3 I think) based on the player's position.

Link to comment
Share on other sites

If the fog doesn't obey the light texture (which it seems not to), this won't work.

 

But it does obey the light texture. I've already tried this.

 

Yes, but you can script the light to change intensity, colour or fog density (shaderParm 3 I think) based on the player's position.

 

Did'nt think of that. Guess that'd be the most fluid option, though it would be a bit tricky getting it to work right.

Link to comment
Share on other sites

Damn, just tried it out again. It did'nt obey the light texture, must've had it confused with something else.

 

I guess the only option is to either edit the shader or use the bind light to player technique.

Link to comment
Share on other sites

Instead of binding to player you could also just use a huge foglight that encompasses the whole level (which can itself be the receipient of scripted events based on player position). Since a foglight is not really a light this will not impact performance.

Link to comment
Share on other sites

Yeah the binding looks really bad, too, at least in it's current state. And the problem with changing the state as the player moves is then you can't see the fog from outside of it, which is one of the most dramatic effects. Still, it's probably usable if there's no other choice.

 

Still thinking about this; there's gotta be some decent solution. Even if it's a light or particle trick at borders/doorways...

Link to comment
Share on other sites

Yeah, the only way to do true volumetric fog is by using a particle effect. Perhaps you could modify your snow/rain emitting texture to emit very large, slow-moving smokepuff particles (which look good as fog if they are sufficiently faint). You might not even have a performace issue if you used large enough sprites, as you would not need that many.

Link to comment
Share on other sites

Well, in playing around I've done some similar stuff (check tdm_dustfog1 and tdm_dustfog2 particles) but not in the direction of true, area covering fog. Even these little versions have their problems, because if you use 'view', they rotate with you (which can sometimes look really bad, depending on the use) and if you use x/y/z orientation, it looks like old school three-axis sprites... /shiver.

 

Incidentally, I think there's a bug in the particle light thingy. If you change the light colors of the particles above even a hair, the whole blending effect is ruined, and they pop in and out of existance, no matter how much you tweak after that. I had to copy and modify an id particle to keep the fading intact. <_<

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Has anyone had any luck with textures from Polyhaven? Their OpenEXR normal maps seem too washed out and give incorrect shading in the engine.
      · 4 replies
    • datiswous

      I tried to upscale the TDM logo video. First try:

      briefing_video.mp4 You can test it ingame by making a copy of the core tdm_gui.mtr and place it in your-tdm-root/materials/ , then edit line 249 of that file into the location where you placed the new briefing.mp4 file.
      What I did was I extracted all the image files, then used Upscayl to upscale the images using General photo (Real-Esrgan) upscale setting and then turn it back into a video.
      I might have to crop it a bit, the logo looks smaller on screen (or maybe it's actually better this way?). My video editor turned it into a 16:9 video, which I think overal looks better than 1:1 video of original.
      · 1 reply
    • nbohr1more

      Trying to be productive on my down-time before Capcom releases Akuma and my son is constantly on my PC playing Street Fighter...
      · 1 reply
    • OrbWeaver

      Finally got round to publishing a tutorial on baking normal maps in Blender, since most of the ones we have are inaccessible or years out of date.
      · 2 replies
    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
×
×
  • Create New...