Jump to content
The Dark Mod Forums

TDM Engine Development Page


zergrush

Recommended Posts

Don't believe me for a second, but there ya go, from Carmack himself: http://fabiensanglar...adowVolumes.txt and he stated that shadow volumes are slower, costly and complex, compare to shadow maps.

 

Note, that was a year 2000. We are getting into 2015 pretty soon, and quality issues with shadow mapping have been resolved on a certain level.

 

That's all nice and dandy, but who is going to rewrite the TDM engine? I don't think we have the resources in one way or another.

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

How do shadow maps work with omnidirectional lights? All the descriptions I have seen assume projected lights with a principal direction and limited "field of view". Do you just treat an omnidirectional light as six spotlights shining in each of the cubemap directions?

Link to comment
Share on other sites

Hmm should be some info around the net but as far as i could understand it it uses the zbuffer (depthbuffer) by copying everything into a depthimage,

and then comparing every point copied,so that if you look out from a lightsource then everything is in the light and any object in the path of that light will be in shadow.

 

Its not as precise as shadow volumes but its a good deal faster :)

Link to comment
Share on other sites

Yes shadow maps need cubemaps for omni lights. And we use mostly omni lights.

Like I said above, I think shadow maps are impossible for us because we already have loads of content that can't be changed to allow the hacks and workarounds that they need, even if we had sufficient coding resource.

  • Like 1
Link to comment
Share on other sites

Don't believe me for a second, but there ya go, from Carmack himself: http://fabiensanglar...adowVolumes.txt and he stated that shadow volumes are slower, costly and complex, compare to shadow maps.

 

The issue for us is that overhauling TDM to such a degree at this point would be suicide. Everything from the missions to the way the lightgem itself works would have to be fixed from the ground up. What we have works very well and continuing to improve what we have is the sane choice.

Link to comment
Share on other sites

Yeah, Penumbra Wedges seem to be a more reasonable option. Of course, for the sake of performance

you could make the wedge have a small fixed distance from the silhouette rather than do the whole distance

based fading thing... or have the two modes performance vs true penumbra.

 

I read an old Beyond3D discussion about Penumbra Wedges and it seems that the coders there were a little

scared to touch them because they thought they were a "patent minefield". Though I don't know why they

would be worried there when some Shadow Map techniques could also be patented.

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

Link to comment
Share on other sites

That's all nice and dandy, but who is going to rewrite the TDM engine? I don't think we have the resources in one way or another.

 

I am not proposing rewriting anything. Just noting that as is shadow volumes are performance hungry. Adding umbra on top of that will reduce performance even further. I was under impression TDM engine needs performance boost, not performance decrease.

Edited by motorsep
Link to comment
Share on other sites

Yes shadow maps need cubemaps for omni lights. And we use mostly omni lights.

Like I said above, I think shadow maps are impossible for us because we already have loads of content that can't be changed to allow the hacks and workarounds that they need, even if we had sufficient coding resource.

 

I am failing to understand how do you need to modify content for shadow maps ? Have you tried RBDoom 3 BFG ? No content needs modification. That's the first time I hear such thing. We added shadow maps to our engine and nothing had to be modified as far as content.

 

You could retarget material for shadow mesh via skin to "nodraw" and comment out noShadows key in the render mesh material. Or leave everything as is - shadow mesh would still cast shadow. Just with increased performance.

Edited by motorsep
Link to comment
Share on other sites

Treb's a good coder, and I'm sure he solved a great deal of the shadow acne issues with the conversion from stencil volumes to shadow maps.

He just doesn't seem to be interested in releasing the work he did on Vanilla Doom 3 to the public.

 

So there we have it.

 

Dead horse beaten beyond a bloody pulpy puddle :laugh:

Edited by nbohr1more

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

Link to comment
Share on other sites

I read an old Beyond3D discussion about Penumbra Wedges and it seems that the coders there were a little

scared to touch them because they thought they were a "patent minefield". Though I don't know why they

would be worried there when some Shadow Map techniques could also be patented.

 

I guess these coders must be pretty excited then that the patent on mip-maps and trilinear filtering will expire in 2016, at which point they are free to use this amazing cutting-edge "invention" in their project.

 

Pretty much everything under the sun is patented. If you're worried about patents you might as well give up writing software altogether.

  • Like 2
Link to comment
Share on other sites

Treb's a good coder, and I'm sure he solved a great deal of the shadow acne issues with the conversion from stencil volumes to shadow maps.

He just doesn't seem to be interested in releasing the work he did on Vanilla Doom 3 to the public.

 

I don't think he did. He made that claim a long time ago. And yet he never released any screenshots, or videos. He did so for xReal, and for BFG, but never for idTech 4. That makes me wonder if such project ever existed. There is absolutely no logical reason to hide it.

Link to comment
Share on other sites

That paper was made by the guy that makes and markets the C4 Engine, a fantastic coder, he even invented alone a better replacement for the collada mesh files, called OpenGEX , about the shadows, on his new engine, version 4.0, he removed Stencil Shadows for shadow maps.

 

Stencil shadows were faster in the old days, but nowadays shadow maps aren't that much slower, plus shadow maps have so much benefits above stencil shadows that the small hit on performance is worth it. About the benefits, shadow maps don't need closed models, Stencil do, shadow maps can be made softer easily, stencil don't, shadow maps support alpha mapped surfaces easily, stencil don't, shadow maps can simulate near contact shadows (shadows that become softer and blurred by distance from the caster), stencil don't.

 

He removed Penumbra Volumes? His March 2014 GDC still speaks above shadow volume optimization:

 

http://www.terathon....c14_lengyel.pdf

 

(boy, you've gotta be a good mathematician to dive into that...)

 

Edit:

 

Some more goodies under the conference slides:

 

http://www.terathon.com/lengyel/

Edited by nbohr1more

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

Link to comment
Share on other sites

He removed Penumbra Volumes? His March 2014 GDC still speaks above shadow volume optimization:

 

http://www.terathon....c14_lengyel.pdf

 

(boy, you've gotta be a good mathematician to dive into that...)

 

Yes he did if you read the Release Notes for the engine version 4.0 you will see that mentioned. Yes, he is a fantastic coder and also a very good mathematician, he even wrote a book about that subject.

 

http://www.amazon.com/Mathematics-Programming-Computer-Graphics-Edition/dp/1435458869

Link to comment
Share on other sites

(boy, you've gotta be a good mathematician to dive into that...)

...hi. I'm only a first-year master's student, so not a great mathematician by any means, but I went through the slides and found them pretty understandable. The most relevant slides are the ones with title "Geometric Computation in 4D" and the "Explicit Formulas". The notations are scattered about through the previous slides.

 

Calculation of shadow planes is done by taking the wedge product of the light origin (point) and line along the edge of the object (refer the second-to-last slide). This will give you the plane containing both the edge and the light origin. By calculating the intersection of this shadow plane with the floor (using antiwedge product of the two planes), you then have found the edge of the shadow.

I guess the real issue would be learnign to work with bi- and antivectors.

 

For me it's more I know very little about rendering and game engines (I can code though), and hence I didn't understand anything about the diffuse lighting example. If you have any question about the mathematics I'd be happy to help though.

  • Like 1

You can call me Phi, Numbers, Digits, Ratio, 16, 1618, or whatever really, as long as it's not Phil.

Link to comment
Share on other sites

The real question is why C4 engine isn't widely used :/

 

We are going off topic here this is not the C4 engine forum, but if you have to know his engine is not widely used because people are looking for shine graphics and not a very well coded and structured engine, his demos were always very simplistic and not very appealing, full of coder art, Eric also takes his time implementing features he still lacks HDR lighting on his engine and SSAO was also implemented only recently, the tools were also not very artist friendly.

Edited by HMart
Link to comment
Share on other sites

Ack, I see now that native doom 3 doesn't output anything but vertex coordinates from the vertex program. I guess sikk's color values are just so he can hook into the result later. It still should be possible to output the penumbra gradient as alpha but we'd need a place to put it. BFG and Morpheus have a shadow fragment program that allows you to modulate the result set. Will have to see if we can easily hook the legacy draw to an ARB output. Either that or pass the alpha render to the light interaction vfp... A few hacks floating around in my mind but nothing that sounds good enough.

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

Link to comment
Share on other sites

Heh, this might not be as hard as I thought. The whole branch for GPU vertex processing is in draw_arb2. We can plug vfp invokes right there.

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

Link to comment
Share on other sites

Hopefully the new soft particles will be the default and we can get rid of the old, ugly ones. I guess even if you are strapped for performance, you don't want the ugly transitions, and would rather dial another setting down instead.

 

As for the smoke vs. halo, would it be possible to make this a parameter in the material files instead of hard-coding it? Or is this unnec.?

 

Good work, btw! :wub:

"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

I've been playing round with the depth hack this morning to see whether we can use it instead of my ignoreDepth keyword to get our particles to draw over the solids in front. The advantage of doing it that way would be we still get to use efficient hardware clipping to cut away unseen parts of the particle, instead of relying on the shader program. I haven't seen any measureable performance difference, but efficiencies are always good. And it's set in the particle declaration, which would give mappers an easy way to tweak the effect.

 

It won't work, but I'll share what I found out anyway.

 

Here's an example of depthHack in action. The three glares on the stairs are all at the same depth, in the middle of the back stair, but the left one has "depthhack 0" in the particle declaration, the middle one has "depthHack 16", and the right one has "depthhack 32". The stairs are 16 deep. DepthHack moves the near clip plane temporarily while drawing the particle so that it gets clipped as if it were however many units in front of where it actually is:

post-29566-0-67486600-1414836686_thumb.jpg

 

The effect is the same as if the engine had moved the particle forward that many units. But that's where the problem comes in. If the player gets closer to the particle than its depth hack value, it vanishes abruptly. No smooth fade-out. And the effect would be really jarring for big particles like dustfogs. They'd vanish while 5-6 feet away. The best depth hack value is about half the particle size, i.e. the radius of the volume that the particle is imitating.

 

There's no way round that for soft particles. Moving the clip plane or the particle itself to get your overdraw means you'll never see a particle from within its "volume". So we'll stick with using ignoreDepth for drawing particles, but we could still use the depthHack parameter to control the particle depth or "radius". It gives mappers an easy way to tweak the effect, unlike the plan I was testing last night which was to get the engine to set the radius of the particle according to the size of the the square images being drawn. And where mappers have already tweaked a depthHack value to fix a particle showing through a wall etc, it'll always be safe to use that value in the soft particle effect too.

 

Hopefully the new soft particles will be the default and we can get rid of the old, ugly ones. I guess even if you are strapped for performance, you don't want the ugly transitions, and would rather dial another setting down instead.

 

As for the smoke vs. halo, would it be possible to make this a parameter in the material files instead of hard-coding it? Or is this unnec.?

 

Good work, btw! :wub:

 

Thanks :)

 

It's kind of in the material files already. The material file chooses the fragment program to use, and it's the fragment program that chooses how the particle fades out. But there's the usual conflict between flexibility and ease of use. The more flexibility we put in material files, the more changes there are to make (we have 97 existing materials used in particles!) and the fewer existing maps will benefit (if they have custom materials). If we hard-code it, you lose some flexibility but there will be less for mappers to do, and existing maps won't need re-releasing to take advantage. If we could find the *perfect* solution, it would make sense to apply it universally in the engine without any changes needed to material files at all. Every map / particle would benefit and it could then be toggled by a cvar/menu option. You can't do that if you've replaced all your materials, at least not without applying another global setting with conditional stages in every material, like we do with the ambient light setting and frob highlighting.

 

There's already special case code in the renderer back end for drawing particles (the model depth hack), so we have options. We can do all the setup in the material files, or we can let the engine handle everything, or some mixture of the two. Ideally we'd not have to change material files, which will mean the engine applying the effect perhaps in response to a parameter in the particle file (like "depthHack" above). And even if we put it all in the engine we can still give full flexibility to future mappers by allowing parameters. The main thing we have to think about is how to fix it up best for existing maps without anything needing changing.

 

I think I know everything there is to know about how the engine draws particles now :) I'll spend my free time while travelling this week thinking up the ideal feature proposal. Suggestions welcome!

  • Like 1
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
       
      · 2 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...