Jump to content

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


SeriousToni
 Share

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.

 Share

  • Recent Status Updates

    • STiFU

      Anyone here played Inscryption? At first, I was like "no, I am not going to play a stupid card game", but this game is so much more than that. It is so meta, full of 4th wall breaks, and feels so damn spooky and weird because of it. Absolutely recommended, if you can stand the visuals. I recommend not reading up too much on it, as that could easily spoil half the incredible surprises. Just know that what you see in the beginning is by far not everything.
      · 1 reply
    • freyk

      Tried to make a tdm advertisement commentpost at one of civvie11 youtube videos about T2. Post got marked as spam. His problem (to not discover TDM for himself),..not my problem.
      But some help of some fellow TDM yt-videocomment posters would be nice. To ask him and others, to play TDM. To get more players/creators. 
      · 2 replies
    • datiswous

      Currently Profile Information has 3 fields, these are shown in forum posts under your avatar:
      1. Gender
      2. Location
      3. Interests
      I think that it could be useful to have an extra field called "Operating system" (under location). It can be useful for tech support and to see what people use.
      Alternatively it could be a more general term, like PC system, so that you can for example state that you use an AMD gpu.
      · 2 replies
    • OrbWeaver

      Greetings fellow kids.
      · 11 replies
    • Crafty_Creeper

      Keep on Creeping on...
       
      · 3 replies
×
×
  • Create New...