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

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...