Jump to content
The Dark Mod Forums

[Feature discussion] Depth of Field effect


MirceaKitsune

Recommended Posts

10 minutes ago, datiswous said:

It might be good to know if devs are willing to integrate a dof effect, if it works, in the engine. Otherwise you have to fork tdm to implement it. Most current posting devs seem uninterested, just saying.

Now that I understand what I'm working on better, I'm trying create a double use shader: It can be used as a view overlay material to get DOF by piping in the depth texture, as well as a surface material to get blurry glass (eg: condensation) by using a dirt map instead. heatHazeWithMaskAndBlur has a constant hardcoded blur, you can't use it to get dirty glass that blurs selectively, the same shader would thus allow glass windows with that effect.

At least the shader will hopefully be acceptable. If for any reason we can't get DoF in the vanilla engine, I can at least create a simple pk4 mod for it this way, albeit that's a lot more limited so I hope it can be done the right way. This is something I've always wanted in TDM so in my book it's worth it, though only if I can get a beautiful and clean result... this will likely require using multiple samples where the image is offset in 4 directions for each one.

Link to comment
Share on other sites

I'm likely going to shelf this one, given there isn't much support from anyone else while any method of implementing it properly is beyond my knowledge. I did want to suggest one more idea that came to mind first, which would have multiple uses and also be per-map without inducing changes by default.

Could we get ambiental blur with an ambient light or fog light texture designed to support blurring by distance? It would require a custom fog shader if one is possible for this purpose, but this approach would allow mappers to add and customize it to their own liking and do so per area. It can for example be used underwater to make it more blurry the lower it goes, in places like a cold cave or refrigerator, or to simulate blurry mist which in some cases appears to be a thing you can see with the naked eye early in the morning. A nice photo to go with the later idea... it's not DOF per say but shows how mist with a little background blur can make sense, blur and color intensity could be adjusted separately so anyone can tweak it to their desired purpose.

foggy-forest-35401-1920x1200.jpg

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

There was a thought still stuck in my mind that I wanted to put up. I noticed DOF as a post-processing feature isn't desired and probably won't happen, I'll likely attempt it as a new fog light shader at some point. But an interesting concept popped to mind which I felt would be interesting at least for the sake of discussion.

People complain of how expensive anti-aliasing is, something I can fully confirm as even 2x or 4x reduce more than 10 / 30 FPS at best. I suggested implementing shader based AA like FXAA for this very reason but that's another story. As its name suggests, MSAA uses multiple samples so each pixel is rendered several times with different interpretations. I believe MSAA is a fixed OpenGL feature in the graphics driver and likely can't be modified directly.

My thought was: If we're trying to get rid of sharp edges and may use multiple samples to do so, a custom AntiAliasing system could do it using positional / angular variation per sample. Think of it as physically based sampling, which as a consequence can also be used to achieve a DOF like effect by naturally emulating the f-stops of a real camera.

This was inspired by how the Eevee rendering engine in Blender seems to function: You give it a fixed number of samples. Each sample is used to randomize various things in the frame, including pixel directions to emulate DOF. Even the soft shadow samples are controlled by it... this might be an interesting way to get soft shadowing, which could be achieved by having each sample interpret the light source as being at a slightly different position.

Unfortunately this would likely be slower than MSAA: It requires rendering the camera multiple times per frame from a slightly different position / rotation to mix up the average result... this must be excruciatingly slow, even at a low value like 4 samples which wouldn't be enough for good looking results. As such it's likely an experiment that won't be considered worth attempting; I'm mainly curious at a concept level how such a thing could work and look like... the technique must have been done before in realtime engines, there's likely even a term for it though I couldn't find it.

Edited by MirceaKitsune
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

    • datiswous

      Fm idea (braindump)
      "Experience the life of a mission builder"
      Esentially there are finnished elements placed somewhere in storage in the game and you have to place them in the correct places, build some walls here and there, add guard routes, give them their correct speech lines, etc. Decorate the places.. all in-game. lots of fun.. 😉
      If you do it right in the end you can play the mission.
      (would be even cooler if a thief-ai could play the mission, making it some kind of tower-defence game)
       
      This first started as an idea for an aquarium builder mission where-in you have to fill an empty aquarium with sand, waterplants, castles water and swimming fish. But above idea is more fun.
       
      · 4 replies
    • JackFarmer

      Dear ChatGPT, What are The Builders in the Dark Mod?
       
      The Builders is a popular game mode in the video game community called "Dark Mod," which is a fan-made tribute to the classic "Thief" series of stealth games. In this game mode, players assume the role of builders who construct structures in a dark and ominous environment while trying to avoid detection by patrolling guards.
      The Builders game mode is unique in that it offers players the opportunity to create and design their own levels using the in-game tools and resources provided. Players can experiment with different building materials, construct intricate traps and puzzles, and create their own unique gameplay experiences.
      While The Builders game mode is not an official part of the Dark Mod, it has become one of the most popular and well-loved aspects of the game, thanks to its emphasis on creativity, strategy, and stealth.
       
      You guys did not know that, did you?
      · 2 replies
    • The Black Arrow

      I know I'm not active much, but it feels a bit too silent in here. Is everyone taffing around, again?
      · 7 replies
    • snatcher

      TDM Modpack v2.8 released!
      · 0 replies
    • kano

      No need to get yourself infected with malwarefor that good old Windows experience of ads and nag screens.
      https://www.neowin.net/news/microsoft-is-now-injecting-full-size-ads-on-chrome-website-to-make-you-stay-on-edge/
      · 3 replies
×
×
  • Create New...