Jump to content
The Dark Mod Forums

How to create a foggy cellar aka. make use of lights & particles


SeriousToni

Recommended Posts

I suggest the following:

  • In shader, return: fragColor.rgb = u_lightColor.rgb * avgColor; and fragColor.a = litDistance * u_dust;
  • In C++ code, always bind _white textures instead of projection and falloff for a fog light.
  • In C++ code, use (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) blending for fogging and (GL_SRC_ALPHA, GL_ONE) for volumetric light.

This covers the projection/falloff textures and blending behavior.

Now add uniform flag "u_exponential", which is enabled for fog light, but disabled for exponential light.
Under this flag, return "1.0 - exp(- litDistance * u_dust)" instead of "litDistance * u_dist" into fragColor.a.
This should switch from linear to exponential.

  • Like 1
Link to comment
Share on other sites

I nearly understand about 1% of what you guys discuss atm, but won't this bring back the "water surface seem" then if the current fog is used with the falloff texture?

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

On 1/14/2022 at 9:02 AM, stgatilov said:

I suggest the following:

  • In shader, return: fragColor.rgb = u_lightColor.rgb * avgColor; and fragColor.a = litDistance * u_dust;
  • In C++ code, always bind _white textures instead of projection and falloff for a fog light.
  • In C++ code, use (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) blending for fogging and (GL_SRC_ALPHA, GL_ONE) for volumetric light.

Now add uniform flag "u_exponential", which is enabled for fog light, but disabled for exponential light.
Under this flag, return "1.0 - exp(- litDistance * u_dust)" instead of "litDistance * u_dist" into fragColor.a.
This should switch from linear to exponential.

I applied all these changes in svn rev 9804.

The alpha equation is a bit different (5.0 coeff under exponent), also added a hack to force opaque fog.
On top of that, I applied a bit of dithering to reduce color banding.

Link to comment
Share on other sites

18 hours ago, stgatilov said:

I applied all these changes in svn rev 9804.

The alpha equation is a bit different (5.0 coeff under exponent), also added a hack to force opaque fog.
On top of that, I applied a bit of dithering to reduce color banding.

Thank you very much! Does this mean I should use the normal fog light again after installing 9804 instead of my "hacked" tdm.exe?

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

7 minutes ago, SeriousToni said:

Thank you very much! Does this mean I should use the normal fog light again after installing 9804 instead of my "hacked" tdm.exe?

It means that most likely you can use this "volumetric fog" in the next 2.10 beta.

Unless we decide to block this feature entirely. It is quite late in the beta phase to add any features.

Link to comment
Share on other sites

Thank you Gospodin Gatilov, I'm keeping fingers crossed for this feature to make it into the next beta. I would be really happy if we can keep this thread as an information source, if this feature will be available in 2.10. It definitely would make fogging much easier for this and all future FMs. Again, thanks to you and the team for every effort in this matter. :)

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

On 1/19/2022 at 5:36 AM, SeriousToni said:

Thank you Gospodin Gatilov, I'm keeping fingers crossed for this feature to make it into the next beta. I would be really happy if we can keep this thread as an information source, if this feature will be available in 2.10. It definitely would make fogging much easier for this and all future FMs. Again, thanks to you and the team for every effort in this matter. :)

I'm sorry, but we decided to not release it yet... Using it will generate a warning.

We have bumped into an issue that fog boundary becomes pretty apparent when you are close to it and look along it. Since I guess this is one of the major issues with the old fog, I think releasing something new with the same problem won't be very helpful.

Note that unlike the old fog, the new "volumetric" fog makes the boundary plane apparent because that's how it should be, i.e. this effect is an correct modelling of a box-shaped fog with constant density. That's what makes it hard to avoid (I don't even say "fix", because it is not a "bug").

Link to comment
Share on other sites

On 1/24/2022 at 2:05 PM, stgatilov said:

I'm sorry, but we decided to not release it yet... Using it will generate a warning.

We have bumped into an issue that fog boundary becomes pretty apparent when you are close to it and look along it. Since I guess this is one of the major issues with the old fog, I think releasing something new with the same problem won't be very helpful.

Note that unlike the old fog, the new "volumetric" fog makes the boundary plane apparent because that's how it should be, i.e. this effect is an correct modelling of a box-shaped fog with constant density. That's what makes it hard to avoid (I don't even say "fix", because it is not a "bug").

Okay thank you for explaining this. I can understand that it doesn't make sense to implement this in that way. I'll delete my fog in that FM and try to insert at least some func_emitters that emit fog sprites. Again, thank you for looking at this.

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

  • 1 month later...

Here is what id's notes had to say about custom images in foglights. I could never get them to have any effect on the appearance, and have long suspected that that note is a relic from an earlier phase of development.

id's D3 mappers seemed to like putting fogs in areas below/above the playable area, to give a sense you were walking over deep pits, so I think the vertical falloff may have been designed around that use case.

  • Thanks 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

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

    • nbohr1more

      Congrats to all the busy Dark Mod developers! TDM 2.12 is here!
      · 0 replies
    • JackFarmer

      @joebarnin
      Jeff, I sent you PM a few weeks back but you did not respond. Maybe your inbox is full?
      · 5 replies
    • The Black Arrow

      I was playing Skyrim, got bored fast. Got back to The Dark Mod just for one mission, played "Somewhere above the City" which is not really a great mission but still good, as in above-average.
      My biggest regret is living in this country, where there's a heat wave, I am sweating at 20c and I really wish for temperatures below 5c.
      · 12 replies
    • Skaruts

      Is there something wrong with the forums lately, or is it my browser? I've been having trouble formatting posts, and just now I couldn't format anything at all.
      I'm using Vivaldi.
      Usually I have to: select text, click bold, nothing happens, select again, click bold, then it works. 
      Same for other stuff, like creating spoilers, bullet points, links. Nothing works the first time. 
      · 1 reply
    • STiFU

      Back from a spontaneous 1-week trip to Lanzarote with wife and son. I hope beta testing has been going well...
      · 1 reply
×
×
  • Create New...