Jump to content
The Dark Mod Forums

[2.11] Stencil shadows optimizations


stgatilov

Recommended Posts

On 10/24/2022 at 4:47 AM, MirceaKitsune said:

Note that when I pressed F12 to take it, I was in reality seeing the the scene just with no shadows... only now noticed everything came out black with only the HUD and entities showing! Will share it here anyway in case it helps.

I have the same issue with stencil shadows enabled, that the screenshots turn out completely dark (lights are not lit on the screenshot). Issue is not present with shadow maps.

Link to comment
Share on other sites

4 hours ago, datiswous said:

I have the same issue with stencil shadows enabled, that the screenshots turn out completely dark (lights are not lit on the screenshot). Issue is not present with shadow maps.

Can't believe I forgot the screenshot issue without realizing that's a bug in and of itself. Indeed: If you take a screenshot with F12, the shot will be saved but it's as if lights are turned off in the image. If I'm not mistaken this indeed only happens when stencil shadows are used? It's possible it may be related to the new optimization though I've yet to test this theory.

Link to comment
Share on other sites

  • 4 weeks later...

Thanks for the improvement to stencil shadows; any and all improvements are always appreciated.

 

That being said, I'm actually surprised that the team isn't preparing to kill stencil shadows entirely. I know it would render the game unplayable on old hardware, but hardware that old will struggle to play the game anyway. And with a full transition to shadow maps, more pretty graphical features can be implemented (like the volumetric shadows and hopefully eventually transparent materials casting shadows), and manpower can be focused on improving one shadowing method instead of two.

Not only do I think it's a great idea to drop stencil shadows, but I also think it would be cool to have a checkbox/option in the editor to allow materials that make use of alpha textures like leaves and grass to cast accurate shadows. Making this into an option that must explicitly be switched on by a mapper would avoid screwing up existing missions that were designed without said functionality in mind, as someone else pointed out, while simultaneously opening up new options for mappers who are creating new content today.

However, the biggest downside to what I am proposing is that shadow maps really tax the GPU and tank performance hard, especially if you crank the quality. It is probably the most impactful performance setting in the game.

Link to comment
Share on other sites

Soft stencil shadows i.m.o. look nicer overall. Volumetric lights automatically work with shadow maps anyway even when Stencil shadows are enabled. This could possibly been done with transparent materials?

39 minutes ago, kano said:

It is probably the most impactful performance setting in the game.

I think anti-aliasing is.

Link to comment
Share on other sites

14 minutes ago, kano said:

Thanks for the improvement to stencil shadows; any and all improvements are always appreciated.

 

That being said, I'm actually surprised that the team isn't preparing to kill stencil shadows entirely. I know it would render the game unplayable on old hardware, but hardware that old will struggle to play the game anyway. And with a full transition to shadow maps, more pretty graphical features can be implemented (like the volumetric shadows and hopefully eventually transparent materials casting shadows), and manpower can be focused on improving one shadowing method instead of two.

Not only do I think it's a great idea to drop stencil shadows, but I also think it would be cool to have a checkbox/option in the editor to allow materials that make use of alpha textures like leaves and grass to cast accurate shadows. Making this into an option that must explicitly be switched on by a mapper would avoid screwing up existing missions that were designed without said functionality in mind, as someone else pointed out, while simultaneously opening up new options for mappers who are creating new content today.

However, the biggest downside to what I am proposing is that shadow maps really tax the GPU and tank performance hard, especially if you crank the quality. It is probably the most impactful performance setting in the game.

I agree and I remember saying something similar before and the answer if I recall correctly was, stencil stays in, that was a few years ago, and they add (and still have) very valid reasons, one was because maps in TDM, was still in its infancy and not well optimized, but it has improved much since (stencil also with the soft shadow option).

Thou I know this is not a easy decision for the team, you can't just delete the stencil shadow code and everything will be fine, TDM age and success, is also a big problem for the way it handles shadows, because of how old and popular it is, it has hundreds of assets and missions made, with stencil shadows alone in mind, changing those assets today (materials mostly), in particular those with alpha enabled, will require free work, from someone, and will also with no doubt, break shadows in all missions made until now and not forget, decrease performance, by the simple fact that, more stuff that didn't cast shadows, trees, grass, banners, decals, etc, now will and some of them shouldn't, so the missions will have to be updated, and it may never happen if the mission maker is gone. Is not a easy problem to solve.

Spoiler

But having said that, to me, not removing stencil shadows, will forever be "a torn in TDM feet", why, because of its existence, shadow maps, the better tech IMO, will never be the main focus for shadows, condemned to be a after thought, so never used to its full potencial, mission makers will forever be forced to make their missions, with stencil shadows limitations in mind, meaning alpha mapped materials, will never cast shadows. (unless they are willing to go to the trouble of modifying the assets themselves and override the default ones from TDM in their mission, afaik is totally possible)

 

Link to comment
Share on other sites

Shadow maps are still too limited to function without stencil shadows, and too GPU-expensive.

Another problem is that even now shadow maps often offer bad quality in TDM.
Stencil shadows don't support alpha-testing and volumetrics, but they just work and provide you with pixel-perfect shadows without huge performance cost.

Shadow maps just cannot work perfectly by themselves.
Of course this is partly caused by weak implementation.
But I regularly see the same pixelization artifacts in modern AAA games, which makes me think that without constant tweaking by artists they can't work properly.

  • Like 4
Link to comment
Share on other sites

Also as someone else once said, it will frequently be quicker in terms of performance to just use texture projection to simulate shadows of complex objects like leaves/grates/etc. This is what Doom 3 did. All those sections where there was a light shining out from behind a grate, casting patterns on the walls? Yep, just a projection.

 

Deus Ex invisible War made heavy use of this too. It's very fast and very cheap.

Link to comment
Share on other sites

Using projected textures doesn't mean the lighting is static though. Doom3 had all sorts of moving lights with projected textures, from ceiling lights that you could knock around, to the flashlight. Also TDM's lantern uses a (very nice) projected texture onto the environment to avoid being a uniformly strong light in all directions.

I think you can even project video/animations if you want to. Admittedly texture projection takes a lot more work to set up and especially to make look good, but it works regardless of which shadows implementation is in use.

Edited by kano
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
On 10/24/2022 at 10:55 PM, MirceaKitsune said:

Right, that's another limitation: Stencil shadows can't produce shadows from alpha textures, .........................

Is this why vegetation can't cast shadows with stencil configuration? Would it be possible to implement with maps?

I had in mind a hypothetical scene in game, where the moon light casts shadows through animated windy tree branches and leaves on the ground. I guess it is too much to hope for at this moment.

edit: ok found the explanation I was looking for in a previous post here:
 

Quote

 

Stencil shadows and shadow maps, have visual diferences and IMO you cannot say one, is higher quality than the other, depends on preference and implementation.

Stencil shadows look very sharp (if you disable soft shadows), no matter the quality level, maps can look very pixelated if you use lower shadow map sizes.

Stencil shadows is extruded geometry (triangle mesh's).

Shadow maps is textures simulating shadows (there its perfect support for alpha mapped materials). 

The only reason some may think, stencil and maps are the same, is because afaik, in TDM the team is forced to limit shadow maps to what stencil shadows can do. What I mean by this is, for example, transparent textures, grass, tree branches and other stuff using alpha maps, shadow maps support those perfectly, stencil shadows don't, so because TDM started historically with stencil shadows alone, afaik no "perforated" materials (alpha mapped materials) in TDM cast shadows.

This is a historical limitation and one that TDM may never be able to change, because has the potencial to break shadows on many older missions, also saves performance...

 

Thinking of the last paragraph, a solution could be by rolling back in an older version in dark mod to enjoy some of the older missions designed with stencil shadow configuration, otherwise dark mod will not evolve at least in this department.

Edited by kin
Link to comment
Share on other sites

18 hours ago, AluminumHaste said:

There nothing stopping players from switching back to stencil shadows for those old missions

Then there is no reason to worry about older missions as stated in that last paragraph.

I am thinking that adding that "small" feature (alpha textures casting shadows) will make the mod look like a different game. If such thing eventualy comes to fruition I will seriously consider getting in to mapping, at least in an architectual manner. It is something I was hopping a long time for dark mod.

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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • 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
×
×
  • Create New...