Jump to content
The Dark Mod Forums

r_showShadows + shadow volumes


SteveL

Recommended Posts

Exactly. And the GPU operation in shadow.vp is indeed skipped for dmapped shadow volumes, but I'm thinking that that doesn't matter because it's a trivial operation, vanishingly insignificant compared with the effort of rasterizing the shadow volumes into the stencil buffer.

 

Right, and now we have unified shaders, whereas the hardware at the time had many more pixel shaders than vertex shaders (e.g. 16 pixel shaders but only 6 vertex shaders), so it would have made sense to limit the vertex shader operation then but maybe not so much now.

 

The bit that won't be trivial on the CPU is sillhouette detection and the constant loading of sillhouette indexes into the vbo. But if we can move that to shadow.vp too... tris whose verts don't get moved and that leave a degenerate edge won't get rasterized will they?

 

An alternative to moving this onto the GPU might be to try and improve CPU-level parallelism, since at the very least I would expect it to be possible to calculate silhouettes of different objects independently, and as I understand it the current engine code is heavily dependent on a single core.

 

maybe moving lights weren't a factor in the original design.

 

That seems unlikely to me, since dynamic lighting was very much a showcase feature for the Doom 3 engine when it came out.

Link to comment
Share on other sites

Cool. We can test it without a special engine build. Dmapping with shadowopt 0 will turn off dmapped shadows completely, and there's another option: you can make the game abandon its dmapped shadows and to start using turbo shadows by using a brief script to move all light origins a tiny amount. That will invalidate all the dmapped shadow volumes.

 

You really don't want to abandon dmap shadows, because performance difference is drastic. Engine will have to calculate silhouettes for _everything_, while with dmap shadows it doesn't calculate anything for prelit shadows.

Link to comment
Share on other sites

The pic above was a turbo shadow, so not related to dmapped shadows.

 

Like you, I assumed that dmap shadow optimisation would merge the smaller shadow into the bigger one, but for whatever reason it doesn't. Here's the same box reverted to worldspawn with its dmapped (green) shadows:

post-29566-0-05067600-1417995096_thumb.jpg

 

That's very odd, I could have sworn that the example of "merged" shadows was one of the reasons to implement this. But an idea occured to me: Are shadows only merged from different models, but not from the same? E.g. if the big and the small box are different statics, their shadows are merged, but not if they are one and the same (in this case it would result in a sort of self-shadowing optimization).

 

But then, I can't think that this (one or two entities) should make a difference to the code, maybe by accident?

 

Edit: A few interesting links:

Edited by Tels

"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

Yeah, gonna be pretty interesting.

I can try this on an ancient G92b part (GeForce 300 OEM) and a high end 780ti.

 

I can throw in a Geforce 9800 GT ;) (The GT probably stands for "Great Turd" :D

"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

... maybe moving lights weren't a factor in the original design.

 

Probably not, I don't think the original D3 had many moving lights. A few like the fireball from imps and rockets, but most stuff was fixed IIRC. We did some Very Bad Things™ like making the player light or candles oscillate every frame, which must be a performance killer if moving lights indeed update a lot of stuff.

"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

That seems unlikely to me, since dynamic lighting was very much a showcase feature for the Doom 3 engine when it came out.

 

But there is a difference between "fixed to position" lights, and "moving lights". And it also depends how many lights move each frame. Isuspect we are using not only many more lights, but also many more moving lights. Most lamp fixtures in D3 levels were fixed (e.g. neon tubes, or bulbs) while we have candles and torches, which oscillate. (And interestingly enough, they only oscillate to create live shadows, not because the light point itself needs to move.)

 

Also D3 levels never had more than 2048 entities, so I guess they were much much more limited.

"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

Moving lights = stationary lights when it comes to performance, assuming they cast no shadows.

 

Stationary lights casting shadows from static meshes (LWO/ASE) and map are _much_ cheaper than shadows cast from moving lights and skeletal geometry.

 

So many moving light + static shadows = ok; many moving lights and dynamic skeletal shadows = death.

Link to comment
Share on other sites

But there is a difference between "fixed to position" lights, and "moving lights". And it also depends how many lights move each frame. Isuspect we are using not only many more lights, but also many more moving lights

 

There were definitely some moving lights; I remember at least one swinging ceiling light in the "mine" levels, and there is a sequence where you follow a guy holding a lantern and have to protect him. But you are probably right in that these were fairly rare examples with only one or two moving lights in the whole scene. The majority of lights were indeed fixed, and those that moved (such as imp fireballs or the plasma gun energy balls) did not cast shadows IIRC.

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

    • 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
       
      · 3 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
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...