Jump to content
The Dark Mod Forums

Value of Shadowmeshes


Springheel

Recommended Posts

It's easy to make a shadowmesh for an animated mesh, but it's not easy to make a *good* one. You have to make sure the shadowmesh doesn't stick out anywhere (otherwise it casts ugly shadows onto the visible mesh) both at rest AND while in motion.

 

I was getting a bit drained working on it, so I decided to confirm that it really was important.

 

I ran the following test in a cube room with two shadow-casting lights and 10 AI in motion.

 

With the shadowmesh on: 15 FPS.

 

With the shadowmesh turned off and the full mesh casting shadows: 9-10 FPS.

 

So yes, in case anyone else was wondering, the shadowmeshes are important. :blush:

Link to comment
Share on other sites

It's easy to make a shadowmesh for an animated mesh, but it's not easy to make a *good* one. You have to make sure the shadowmesh doesn't stick out anywhere (otherwise it casts ugly shadows onto the visible mesh) both at rest AND while in motion.

 

I was getting a bit drained working on it, so I decided to confirm that it really was important.

 

I ran the following test in a cube room with two shadow-casting lights and 10 AI in motion.

 

With the shadowmesh on: 15 FPS.

 

With the shadowmesh turned off and the full mesh casting shadows: 9-10 FPS.

 

So yes, in case anyone else was wondering, the shadowmeshes are important. :blush:

 

The shadowmesh should become even more important with complex environment, because every shadow casting polygon will be computed against every shadow-receiving polygon. Could you do a quick test (with maybe some complex models or just some duplicated patches/brushes) to see what the effect really is?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

The shadowmesh should become even more important with complex environment, because every shadow casting polygon will be computed against every shadow-receiving polygon.

 

Shadow volumes are computed once for each light, the number of "receiving" polygons doesn't make any difference to the calculation.

 

A complex environment will of course generate more shadows, and be more expensive to render in itself, but shouldn't have any effect on the shadows which are falling on it.

Link to comment
Share on other sites

Shadow volumes are computed once for each light, the number of "receiving" polygons doesn't make any difference to the calculation.

 

A complex environment will of course generate more shadows, and be more expensive to render in itself, but shouldn't have any effect on the shadows which are falling on it.

 

But what if a shadow polygon falls on 1 vs. 3 polygons. Doesn't this make the shadow-casting process more complicated?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

But what if a shadow polygon falls on 1 vs. 3 polygons. Doesn't this make the shadow-casting process more complicated?

 

No, because the algorithm does not involve calculating intersections between shadow volumes and rendered geometry; it is per-pixel, not per-vertex or per-poly.

 

Wikipedia has a reasonably good description of stencil shadows. Note how the shadow effect arises from rendering the shadow volume itself into the stencil buffer, and then using this buffer to test against the depth values of the final rendered scene to determine whether a given pixel is in shadow or not.

Link to comment
Share on other sites

No, because the algorithm does not involve calculating intersections between shadow volumes and rendered geometry; it is per-pixel, not per-vertex or per-poly.

 

Wikipedia has a reasonably good description of stencil shadows. Note how the shadow effect arises from rendering the shadow volume itself into the stencil buffer, and then using this buffer to test against the depth values of the final rendered scene to determine whether a given pixel is in shadow or not.

 

Ah thanx. So the amount of work in this technique (which is used in D3) is a per-light pass, and thus depends only on the shadow polygons and the screen resolution, not what is in shadow or not. (If I understood that correctly)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Ah thanx. So the amount of work in this technique (which is used in D3) is a per-light pass, and thus depends only on the shadow polygons and the screen resolution, not what is in shadow or not. (If I understood that correctly)

 

Yes, exactly. That is why light count and shadow-mesh complexity are so much more important than the polycount of rendered objects themselves.

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

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 3 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...