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

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 5 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...