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

      Taking a break to alleviate burnout. In retrospect, I probably shouldn't have jumped into a map-making contest so quickly after just finishing another project and especially with my busy schedule, but I do believe I have something that the community will enjoy. No clue if I'll be able to finish it on time for the competition if I factor in a break, but I'd rather take my time and deliver something of quality rather than engage in development crunch or lose part of the map's soul to burnout.
      · 1 reply
    • Skaruts

      Working on an update for my mission By The Cookbook. If anyone that played it has any further bugs to report, please let me know.
      I posted more details about the update in the mission thread.
      · 1 reply
    • lucien

      being thankful for tdm is a good feeling
      · 0 replies
    • The Black Arrow

      Happy birthday to me!
      Yes, today's my birthday and as much as I want to play The Dark Mod, I won't until it's late Autumn, where it should be a bit chilly in my place and there's some wind too.
      For now, it's time to enjoy my birthday, if any of you want to play a great fan mission in my honour...Well that's asking too much, just play the mission because it's fun, not because of me, enjoy it yourself! 💪
      · 5 replies
    • nbohr1more

      New texture wiki article created: https://wiki.thedarkmod.com/index.php?title=Creating_textures_from_Ornate_Photos
      · 11 replies
×
×
  • Create New...