Jump to content

[2.10] Volumetric Lights


duzenko
 Share

Recommended Posts

  • 2 weeks later...
On 8/13/2022 at 1:29 PM, stgatilov said:

We did some refactoring related to shadow modes, and as the result we can now easily switch between stencil and shadow maps on per-light basis.

Starting from dev16599-10071, volumetric lights display properly with stencil shadows mode selected in settings menu.
It works by forcing the particular lights with volumetrics into using shadow maps instead of stencil shadows.

The special "volumetric_noshadows -1" setting is useless now, as well as the whole volumetric_noshadows spawnarg.

 

Is it possible for future releases to have shadow maps with the same impact on computer resources as stencil shadows?

Link to comment
Share on other sites

On 8/13/2022 at 5:29 AM, stgatilov said:

Starting from dev16599-10071, volumetric lights display properly with stencil shadows mode selected in settings menu.
It works by forcing the particular lights with volumetrics into using shadow maps instead of stencil shadows.

Sounds like a neat feature. I prefer the look of stencil shadows and wondered about missing out on volumetric lighting, so this sounds quite promising.

I do have some concerns, though. In Iris when I have shadow maps turned on, I see graphical artifacts. Have shadow maps been improved to where those artifacts no longer show? Please see comparison screenshots.

Edit: It seems the uploaded images get processed somehow, so the artifacts look different than the original file. Welp. But the 3rd screenshot (stencil vs maps) looks almost the same.

Screenshots:

  1. stencil
  2. maps
  3. stencil vs maps

 

stencil.webp

maps.webp

stencil-vs-maps-artifacts.webp

Edited by Daft Mugi
Link to comment
Share on other sites

2 hours ago, Daft Mugi said:

Sounds like a neat feature. I prefer the look of stencil shadows and wondered about missing out on volumetric lighting, so this sounds quite promising.

I do have some concerns, though. In Iris when I have shadow maps turned on, I see graphical artifacts. Have shadow maps been improved to where those artifacts no longer show? Please see comparison screenshots.

Edit: It seems the uploaded images get processed somehow, so the artifacts look different than the original file. Welp. But the 3rd screenshot (stencil vs maps) looks almost the same.

The implementation of volumetric lights in 2.10 uses dithering to reduce performance impact.
What you show here is exactly the dithering effect: the image looks good in large scale, but on small scale it is a mess of pixels. Moreover, the more high-frequency details you have, the more apparent the dithering artefacts become.

So there are only 2 explanations why scene looks better with stencil shadows:

  1. Because when you use stencil, volumetric light is disabled --- that's default behavior of volumetric lights in 2.10.
  2. Because when you use stencil, volumetric light is used without shadows. This makes dithering artefacts hardly noticeable, since the light itself is very low-frequency, while shadows are high-frequency.

With new dev builds, you'll have dithering artefacts as you see in 2.10 with shadows maps, but now you'll see them regardless of your choice. And the reason for that is that now volumetric lights always take shadows into account if mapper wanted them to exist.

We plan to add blur and thus remove dithering artefacts: 5850

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

@stgatilov I did some testing. The volumetric lighting does look significantly better! I appreciate the work you've done to remove the dithering artifacts.

I also tested The Painter's Wife and could see all of the stencil shadow optimizations you've done have made a significant performance improvement! It's really impressive!

However, volumetric lighting (r10157) causes significant performance degradation and still has some graphical artifacts. I'll post about those later. I tried out different volumetric settings, such as r_volumetricSamples, to compare performance vs quality. Even with higher settings, there are still graphical artifacts, unfortunately. As for performance, the wattage sent to my video card doubled in some scenes compared to r9853/2.10, and its fan goes from off to on. Being concerned with the video card wattage, heat, and fan being on (i.e. fan noise) may be ludicrous to some who are used to playing recent AAA titles, though. As things are now, I'd rather have volumetric lighting toggled off for improved performance (i.e. no fan noise) and no graphical artifacts (i.e. distractions).

Could you please add a cvar for toggling volumetric lighting on/off?

Even though I'd rather have volumetric lighting off, I do appreciate all the work you've done on this. It has improved a lot.

Link to comment
Share on other sites

10 minutes ago, Daft Mugi said:

However, volumetric lighting (r10157) causes significant performance degradation and still has some graphical artifacts. I'll post about those later. I tried out different volumetric settings, such as r_volumetricSamples, to compare performance vs quality. Even with higher settings, there are still graphical artifacts, unfortunately.

Yeah, there are indeed some. It's nowhere possible to make it pixel-perfect and cheap today.

Quote

As for performance, the wattage sent to my video card doubled in some scenes compared to r9853/2.10, and its fan goes from off to on.

The new volumetric shadows are expected to be faster than ones in 2.10.
If you have severe performance degradation (e.g. measured with uncapped FPS and max FPS set to 500), we'd better find out at least approximately where it starts and what causes it.

Quote

As things are now, I'd rather have volumetric lighting toggled off for improved performance (i.e. no fan noise) and no graphical artifacts (i.e. distractions).

I bet some maps like Hazard Pay will look very wrong if you just disable the volumetrics.
You can go to 2.10 state with: "r_volumetricLowres 0" and "r_volumetricBlur 0".

Quote

Could you please add a cvar for toggling volumetric lighting on/off?
Even though I'd rather have volumetric lighting off, I do appreciate all the work you've done on this. It has improved a lot.

Did you try setting "r_volumetricSamples 0" ?
That should disable expensive sampling: without it the effect would be very cheap.

Link to comment
Share on other sites

1 minute ago, stgatilov said:

The new volumetric shadows are expected to be faster than ones in 2.10.

Ah, sorry, I should have been more clear.

As for performance using stencil shadows, the wattage sent to my video card doubled in some scenes compared to r9853/2.10 (stencil shadows / no volumetric lighting), and its fan goes from off to on.

Link to comment
Share on other sites

27 minutes ago, Daft Mugi said:

As for performance using stencil shadows, the wattage sent to my video card doubled in some scenes compared to r9853/2.10 (stencil shadows / no volumetric lighting), and its fan goes from off to on.

I still don't understand where is the problem.

What else you can try:

  • r_softShadowsMipmaps 0: the new optimization for soft stencil shadows uses more memory, and in some cases might even be slower.
  • r_volumetricForceShadowMaps 0: this flag is for the change where lights with volumetrics are switched to shadow maps even if you have stencil shadows selected.
  • r_shadowMapSize 512: this means using 2x lower resolution for shadow maps. Shadow maps take quite a lot of memory (144 MB at defaults) and fillrate, so lowering it down might help.
  • Like 1
Link to comment
Share on other sites

This post is quite frustrating for me, because it sounds quite critical. In person, it would be easier to point out the good parts and ask what's going on with other parts. Without that, unfortunately, it's just using this limited medium of text and a few screenshots to point out things and hoping there is a solution, which isn't an ideal way to communicate.

Edit: The main thing is that I know that you, @stgatilov, did a lot of great work on this. I've seen the commits and improvements over time, and I appreciate you spending your time to improve this game we like to play. So, I really don't like to talk about aspects I don't enjoy, and unfortunately, I'm not enjoying volumetric lighting. The volumetric lighting in Hazard Pay has quite a few issues that degrade its look, but the one volumetric light I noticed in Iris (Moonlit Manse area) looks good. So, maybe it really depends on the volumetric settings in each map, and they can be tweaked/fixed.

 

I'd like to see an option in the settings menu to enable/disable volumetric lights. Could you please add that cvar? Something like r_volumetricLights 0/1.

This has three benefits:

  1. For those who prefer the look of the game without volumetric lights, they can turn it off. This is really not different from being able to toggle bloom, ambient occlusion, color precision, and shadows maps vs stencil shadows, so why not volumetric lights as well?
  2. It'll help those who are having performance issues or need to keep the temperature of their graphics card at a minimum. Volumetric lights (or maybe it's really the shadow maps?) add between 5 to 25 watts of power to the graphics card I measured. I imagine those playing on a laptop would be impacted the most. Others may get unwanted fan noise.
  3. It'll help with measuring and comparing the performance between volumetric lights off and on.

 

As for player preference, the moving volumetric lights in Hazard Pay cast shadow maps with edges that wiggle/wave whereas stencil shadows are static/still. That wiggle/wave doesn't look good and is distracting. Maybe the shadow maps can be improved to fix that? It also has fog that has graphical artifacts that look like distorted waves, but those can be fixed/reduced by increasing r_volumetricSamples from 8 to 24 (screenshot #1). Other volumetric lights have fog with multiple ring artifacts that no setting I tried fixed/reduced them (screenshot #2 with ring pattern marked). The rings seemed to be where the fog touches the wall. There are some volumetric lights that make areas of a scene overly bright, especially when two volumetric lights overlap (screenshot #3). Given all that, the look of stencil shadows without volumetric lights is preferred.

 

As for performance, it's probably pretty good to great, but I don't know how to quantify it other than that it adds 5 to 25 watts of power to my graphics card, generating more heat. (Again, maybe it's really the shadow maps?) The FPS is a steady 60 fps even with all settings maxed out.

  • r_softShadowsMipmaps 0: Added ~10 watts in one scene.
  • r_volumetricForShadowMaps 0: Turns off shadows completely where there is a volumetric light. Stencil shadows are not used/seen.
  • r_shadowMapSize 512: Reduced ~5 watts in one scene.
  • r_volumetricSamples 0: Can significantly reduce wattage (~10 watts in one case), but then it looks blocky, of course. Interestingly, when I set r_volumetricSamples from 8 to 100, it might add ~5 watts without an FPS drop.

 

I hope volumetric lights can improve a bit more along with an option in the settings to enable/disable them.

hazard-pay-volumetric-waves.webp

hazard-pay-volumetric-rings.webp

hazard-pay-volumetric-overly-bright.webp

Edited by Daft Mugi
  • Thanks 1
Link to comment
Share on other sites

21 hours ago, Daft Mugi said:

I'd like to see an option in the settings menu to enable/disable volumetric lights. Could you please add that cvar?

I added a cvar r_volumetricEnable.
Note that you should run reloadModels after changing this cvar, just like you need when you change r_shadows.

Quote

As for player preference, the moving volumetric lights in Hazard Pay cast shadow maps with edges that wiggle/wave whereas stencil shadows are static/still. That wiggle/wave doesn't look good and is distracting. Maybe the shadow maps can be improved to fix that?

It seems that you don't like shadow maps in general 😀

These are the typical pixelization artefacts which I also hate in shadow maps.
When there are too many shadow-mapping lights being rendered, some lights are automatically switched to lower resolution, which makes the issue even worse.
And one way to somewhat mask this problem is to use soft shadow maps... which are very expensive in TDM right now.

Ideally, we should render shadow map with low resolution, then render stencil shadows as usual and use them for shadowing, but use shadow maps for volumetrics. But I'm not sure having both implementations of shadows fits the renderer architecture, unfortunately.

Quote

It also has fog that has graphical artifacts that look like distorted waves, but those can be fixed/reduced by increasing r_volumetricSamples from 8 to 24 (screenshot #1).

This is not noticeable in a still screenshot, but I found this location and I see the problem.
I have found a similar case at 3986.7 2463.3 -222.85.
I guess I should look into it.

Quote

Other volumetric lights have fog with multiple ring artifacts that no setting I tried fixed/reduced them (screenshot #2 with ring pattern marked). The rings seemed to be where the fog touches the wall.

It looks like color banding, because volumetrics are computed in 8-bit FBO.
I knew about this problem, but it did not look so bad on testmap, and I thought maybe I could ignore it.
But in Hazard Pay, there are many places where color banding is strong.

I can "simply bump" FBO to 16 bits, doubling memory bandwidth, or adding dithering... I wonder if there is another option.

Quote

There are some volumetric lights that make areas of a scene overly bright, especially when two volumetric lights overlap (screenshot #3).

When I flew around this map, the brightness of security cameras looked over-the-top for me too.
But now that I look at the map, it seems that volumetric_dust is set to default here.
@Dragofer, maybe we should tone down security cameras by default?...

Of course, this issue is greatly magnified by gamma-incorrect rendering pipeline, so when several light sources overlap, their brightness gets much larger than just their sum. Not fixable right now 😰

Quote

As for performance, it's probably pretty good to great, but I don't know how to quantify it other than that it adds 5 to 25 watts of power to my graphics card, generating more heat. (Again, maybe it's really the shadow maps?) The FPS is a steady 60 fps even with all settings maxed out.

I can't understand how a game can be blamed for increased power consumption. Loud noise... probably means that this particular piece of hardware has bad fans.
But I agree that this is a sign of greater performance cost in general, which can lower FPS for you in other cases, or for other people.

Quote

r_volumetricForShadowMaps 0: Turns off shadows completely where there is a volumetric light. Stencil shadows are not used/seen.

I guess you need to do reloadModels, since this cvar changed shadows model of some lights.

Quote

r_softShadowsMipmaps 0: Added ~10 watts in one scene.
r_shadowMapSize 512: Reduced ~5 watts in one scene.
Interestingly, when I set r_volumetricSamples from 8 to 100, it might add ~5 watts without an FPS drop.

It looks like your GPU increases power consumption when you increase memory bandwidth. Computations don't matter that much.
It's no wonder you see no performance drop: you have 60 FPS cap.

Given that now volumetrics are rendered at half-resolution, number of samples per pixel does not affect performance so badly. Maybe I should just bump them to e.g. 24, I don't know.

  • Thanks 1
Link to comment
Share on other sites

I am curious to know whether the banding and ring artifacts happen if you also enable volumetric dither.

In the current design both blur and dither can be used together rendering a smoother overall appearance.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

1 hour ago, stgatilov said:

I added a cvar r_volumetricEnable.

Thank you! This is really helpful.

I've bound the following, so I can easily enable and disable volumetric lighting. It's quite interesting to see the differences.

bind "[" "r_volumetricEnable 0; reloadModels"
bind "]" "r_volumetricEnable 1; reloadModels"

 

I'd like to point out that r10159 power consumption has improved a lot since r9853. Awesome work!
 

Iris (Moonlit Manse area)
=============================

No Volumetric Lighting

stencil  r9853: 45 - 50 Watts
stencil r10159: 35 - 40 Watts

-----------------------------

Volumetric Lighting (r_volumetricSamples 24)

   maps  r9853: 90 - 100 Watts
stencil r10159: 60 -  70 Watts

 

1 hour ago, stgatilov said:

It seems that you don't like shadow maps in general 😀

Yep, I don't like how shadow maps have edges with artifacts and as a whole can have other artifacts in some cases. I guess the increased power consumption is an issue as well.

I appreciate your continued work on this.

Cheers!

iris-r10159-volumetrics-comparison.webp

Link to comment
Share on other sites

1 hour ago, stgatilov said:

When I flew around this map, the brightness of security cameras looked over-the-top for me too.
But now that I look at the map, it seems that volumetric_dust is set to default here.
@Dragofer, maybe we should tone down security cameras by default?...

Kingsal has set a custom light colour on the security cameras in his map, and I suppose he chose a value that looks good to him on his PC & settings. I doubt changing the default spotlight settings would be the way to go here.

Link to comment
Share on other sites

@stgatilov I've found a difference between r9853 stencil and r10159 stencil with r_volumetricEnable 0 while playing Written in Stone. (See screenshot.)

How is there this difference? It seems WIS is using transparent geometry when using stencil shadows in r9853, but those don't show in r10159 with r_volumetricEnable 0. Can this be fixed?

written-in-stone-r9853-vs-r10159-stencil.webp

Link to comment
Share on other sites

Not sure you understand the feature.

That transparent geometry IS WHY these these are called "volumetric".

All Doom 3 \ TDM lights use light volumes but the new "volumetric" lights are meant to render

God Rays, light shafts, etc by filling the light volume with transparent dust \ fog.

When you disable the volumetric feature the lights go back to being standard TDM lights with no God Rays and dust.

The other rays and dust in the scene above are made by particles and patches.

  • Sad 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

22 minutes ago, nbohr1more said:

Not sure you understand the feature.

In r9853, volumetric lighting (god rays) was presented as shadows maps have them and stencil shadows don't. I was using the terms/features as they were presented. The Written in Stone screenshot for r9853 was taken using stencil shadows, so I assumed volumetric lighting was not used. Hazard Pay and Iris don't have god rays when using stencil shadows. How is it that Written in Stone has them when using stencil shadows?

Link to comment
Share on other sites

The story about volumetric lights and stencil shadows is rather messy.

Initially, we did not force lights with volumetrics from stencil to shadows.
As the result, with stencil shadows volumetrics simply passed through all obstacles. And several mappers were disappointed by that, saying that volumetrics leaking through stuff has bad consequences for gameplay.

Then we changed the behavior: if player uses stencil shadows, then volumetrics are simply disabled.
But since it many cases (especially where old-school transparent geometry was used) shadows are not necessary, we added a way for a mapper to mark volumetric light as "using shadows in volumetrics not required". As the result, mapper could make some volumetrics work even with stencil shadows. Of course, this markup is not very popular, but the particular light that you found most likely has it.

Then after 2.10 we implemented a force-switch from stencil shadows to shadow maps for the lights with volumetrics.
At this moment, the markup is probably not necessary.

The cvar "r_volumetricEnable 0" simply removes all kind of volumetrics without second thought.
 

So in this case volumetric light was used, but it worked with stencil shadows because mapper allowed it drop shadows completely.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

I thought Hazard Pay looked super sanddusty, but asume this is part of the theme. Shadows also have low contrast because of the volumetric lights. I like it when shadows have a stark contrast with the lighted parts. I often miss that with volumetric lights. I can also see this problem in the above screenshots from Written in Stone. It's probably because you look through the volumetric light toward lighted-shadowed scenes, which become less contrasty because of it.

Link to comment
Share on other sites

20 hours ago, stgatilov said:

But since it many cases (especially where old-school transparent geometry was used) shadows are not necessary, we added a way for a mapper to mark volumetric light as "using shadows in volumetrics not required". As the result, mapper could make some volumetrics work even with stencil shadows. Of course, this markup is not very popular, but the particular light that you found most likely has it.

Thank you for the great explanation! 😀

Initially, I hoped to have a cvar that would restore the look of r9853 with stencil shadows, but now with more understanding, it seems that doesn't make much sense. Future maps are going to be built with the assumption that they exist (and probably not use that "using shadows in volumetric not required" option). Besides, volumetric lighting is growing on me. I think they look great in Iris and Written in Stone, and the performance cost is a little better than I originally thought.

The cvar r_volumetricEnable is still incredibly valuable, and I'll continue to use that.

From now on, I hope you don't mind me sharing bugs or rendering artifacts I find. I look forward to seeing volumetric lights get better and better. 😀

Edited by Daft Mugi
Link to comment
Share on other sites

I've found that while playing Hazard Pay with r10159 the distant pyramid structures in the background are missing their shadows compared to r9853. (See screenshot.)

When r_volumetricEnable 0 with r10159, the shadows are present.

 

hazard-pay-missing-distant-shadows.webp

Edited by Daft Mugi
  • Like 1
Link to comment
Share on other sites

@Daft Mugi, please test the latest source code SVN.

I fixed color banding issue and bumped default number of samples.
Of course, shadow maps are still as bad as they where, and you won't get less work for you GPU, but I hope most of artifacts in volumetrics themselves are gone now.

By the way, you can further reduce GPU load by setting "r_volumetricLowres 2", which would mean rendering volumetrics and quarter-resolution. You might get more blurry or messy look, but it should be noticeably cheaper.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

5 hours ago, stgatilov said:

I fixed color banding issue and bumped default number of samples.

Fantastic work! I can still see some banding, but I really have to look hard for it now. If I didn't know it was possible, I don't think I'd notice, and it's imperceptible during regular gameplay. I'm enjoying the change! 😀

Edited by Daft Mugi
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

    • peter_spy

      It's funny how perception changes over the years. I've been replaying Bioshock in its Remastered version, and I'm surprised how bad the level design actually is. It's just a series of abstract corridor mazes that you can't really map out in your head. There's nothing that would ground them in any kind of reality, fictional or otherwise, no sense of place people could live in. It's almost like Wolfenstein 3d with cool art deco assets.
      · 1 reply
    • 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.
      · 4 replies
    • 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. 
      · 5 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
×
×
  • Create New...