Jump to content
The Dark Mod Forums
Sign in to follow this  
oneofthe8devilz

Thief3 vs Doom3 Stencil Shadows Polygon Popping Solutions

Recommended Posts

Addressed towards every idtech4 aficionado @ the TDM forums and in particular towards the TDM Engine Development team...


Both engines use Stencil Shadows but the devs at Ion Storm IMO came up with the significantly more elegant solution to the "Shadow Polygon Popping" issue that comes with the Stencil Shadow rendering technique...


I remember back in the days around Doom3's release (August 2004) how John Carmack mentioned having added "noselfShadow" material flags specifically to combat the problem of "Stencil Shadow Polygon Popping" which would appear on Characters and Monsters when selfshadowing would kick in which resulted in my first mini-mod "UEQ" basically just commenting out all "noselfShadow" flags for all Doom3 Character/Monster material shaders...


u-e-q-mod.jpg


I have recorded some footage to illustrate why I think Thief3's solution is indeed more elegant in the hope that some of the senior GFX engine programmers like duzenko and the rest of the TDM Engine Development team might point me to a direction of implementing a similar solution within idtech4...


The Problem (within idtech4):




When a character in idtech4 is rendered without disabled selfshadowing in the material shader, quite some noticeable "Shadow Polygon Popping" can be observed (In this sample scene you can see it happening around Garrett's Hood and Shoulder area).


The more elegant Solution (within Thief3):




Notice how the character still casts and receives selfshadows without any "Stencil Shadow Polygon Popping" occurring. The shadows rather "slide" across the model surface instead of harshly popping in and out of existance...


Now of course idtech4 is highly configurable by default so I started tinkering with the stencil shadow parameters. In particular I would change the value of the CVAR "r_shadowPolygonOffset" from the default value "-1" to "-2000".




Now that still doesn't look as "clean" as in the Thief3 sample footage but at least the self shadows stopped harshly popping in and out of existence and instead (similar to the Thief3 footage) now slide smoothly across the model surface.


Mission achieved you might think and wonder why I am still flagging this an issue...


Well the problem becomes apparent when we start to move around the environment with these new settings ("r_shadowPolygonOffset -2000"):


Watch the shadow on the right side of the Windowframe increasing in size/volume as I approach it and decreasing in size/volume as I move away again from it:




This now happens with every selfshadow in the world around me (within idtech4 with "r_shadowPolygonOffset -2000").


On the other hand, within the Thief3 engine a similar behavior but much much more subtle in scale/resize of SelfShadows can be seen:




When you observe the shadow at the left side of the door... (it actually might be difficult to notice) but you can see that that shadow also changes size/volume depending on my distance to it but like I mentioned the change is way more subtle in scale compared to the idtech4 showcase.

Edited by oneofthe8devilz
  • Like 1

I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
Share on other sites
The last footage I would like to showcase is from within the Thief3 Editor where I am dynamically moving a pointlight-light-source around so the algorithm can be observed in detail... especially pay attention to the low poly bucket in the center foreground of the scene and how the selfshadow casting is always offset proportionally to the distance and position of the light source ensuring that none of the objects ever experience any kind of "Stencil Shadow Popping In and Out" but instead the SelfShadows smoothly slide along the objects geometry surface...




I am very curious to find out whether someone from TDM's Engine Development team might have an idea how the Thief3 engine manages to prevent "Stencil Shadow Polygon Popping" without severely affecting the SelfShadow volumes/sizes within the player's view proximity...


I play both games/engines in VR and having something close to Thief3's solution would be amazing as that game is still my supreme immersive VR experience and finding a way to port that to idtech4 would be a dream.


Thanks for you attention.


[ I had to split this thread into 2 initial posts as it seems these forums limit the maximum number of linked youtube videos to "5" per post ]

Edited by oneofthe8devilz
  • Like 1

I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
Share on other sites

It looks like it could be normal mapping issues, not shadows

There is a @stgatilov's forum thread about that but I can't find it

Share this post


Link to post
Share on other sites

It looks like it could be normal mapping issues, not shadows

There is a @stgatilov's forum thread about that but I can't find it

 

That's interesting... On a first quick glance I am unable to spot any difference within the tanget space normalmaps used in both games/engines...

 

(Garrett's Hood NormalMap)

 

hood_local.jpg

Edited by oneofthe8devilz

I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
Share on other sites

This would be solved if you used shadow maps! :P JK

 

That does look like something John Carmack didn't bother to solve as they decided to just turn off selfShadows for characters, because if he really wanted to solve that IMO he could, is not like the Ion Storm guys were better (or worse) coders. :)

 

btw not a graphics programer so no help from me, sorry...

Edited by HMart
  • Like 1

Share this post


Link to post
Share on other sites

I personally believe it is still a way of offsetting the stencil shadows but in a slightly different way than the idtech4 default CVARs currently allow us.


I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
Share on other sites

Yes, we did some work on this:

 

(Internal thread)

 

http://forums.thedarkmod.com/topic/19139-nonsmooth-graphics-due-to-bumpmapping/

 

Bug tracker:

 

http://bugs.thedarkmod.com/view.php?id=4825

 

There are at least two few factors in play here.

 

1) If a model does not have vertex smoothing, then lighting will harshly change at face intersections

2) Self-Shadows are derived from the shadow mesh and thus are often limited in vertex resolution

 

Humus solved this sort of problem by using a horizon map to make it appear that the normal map is contributing to the shadow:

 

http://www.humus.name/index.php?page=3D&ID=38

 

He claimed the performance impact wasn't "horribly expensive" but requires a "3D texture of considerable size"...


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...)

Share this post


Link to post
Share on other sites

Since I don't have access to the internal thread I did a quick replication test within TDM (version 2.07) and can confirm that I am able to replicate the Stencil SelfShadows Polygon Popping.

 

 

A few years ago I managed to get in touch with one of the programmers from the Thief Deadly Shadows engine tech team, so this is an excerpt of some of the things he replied to me:

 

I also seem to remember we did some offsetting with the backface projections and detection of when to call something backfaced (basically bias/bend the normals) that helped with that triangle popping that you always see with shadow volumes (hard to recall the details without a code reference).

I contacted him recently again and will update this thread in case he replies with more information about this topic

  • Like 1

I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
Share on other sites
It looks as if realtime RayTracing might truly be the ultimate solution to resolve the decades long "shadow precision dilemma" battle between Stencil Shadows and ShadowMapping...





Edited by oneofthe8devilz

I got six little friends and they all run faster than you ;)

 

sps_banner_icon.jpg

Check out our mods at

moddb or the SPS Homepage

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...