Real time shadows - the good news, and the bad news :P

D2X-XL - Descent II update for modern systems with many new features and enhanced graphics. Home Page

Moderators: Grendel, Aus-RED-5

User avatar
Shadowfury333
DBB Ace
DBB Ace
Posts: 326
Joined: Mon Aug 09, 2004 8:36 pm

Post by Shadowfury333 »

Diedel wrote:Btw, I am working on preventing shadows from going through walls, but the solution is a big performance killer.
To be honest, I was aware of that when I told you, but I can't think of any other way.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

CDS,

I will turn down reach of shadows, that should at least reduce the problem of 'rogue' shadows (those going through walls).

I would not use LOR for showing off shadows though. The Boss room of D2 Level 4 is pretty well suited. To avoid the rogue shadow problem, you can extract it from descent2.hog, remove all bots except those in the boss room, save it in a separate file and use that one. Unlock all doors by entering 'cryptonite' *twice*. You can get all weapons with 'honestbob'. Use 'alifalafel' first to get the ammo rack, that will give you double weapon supply. Turn off the hud in the cockpit config menu for nicer screens. Make yourself invulnerable by typing 'almighty'.

You need to balance the features you want to show really well, or the video will look overloaded.

That boss room looks pretty neat with shadows and smoke turned on (medium density and part size imo looks best, otherwise the smoke gets too dominant).

If you use a modified version of that level, you may want to edit the boss too and give it another homing weapon type (currently has flash missiles which may not look too good in a video - white screen all the time ... :P).

If you can do that, showing a feature like the following:

Make short video sequence of screen w/o feature, then turn on feature; separate both sequences (cut) and make the second blend into the first

would look cool.

You could also do that for the automatic color and transparency effects for standard levels (the latter means that D2X-XL will make water and lava a little transparent if there's something behind them, i.e. you can fly through it).

Would also look cool if you did that with D1:Lvl1 and LOR: First get the start room of the original level, then of LOR. You can edit LOR and change the start position to the segment in front of the round entry door to achieve similar view points.
User avatar
Tyranny
DBB Defender
DBB Defender
Posts: 3399
Joined: Sun Nov 10, 2002 3:01 am
Location: Phoenix, Arizona

Post by Tyranny »

Someone needs to re-design the ship HUD both standard and mini and the reticle to match with all these hi-res improvements.

EDIT: meh... viewtopic.php?p=182746#182746

btw, thats great D, you're really kicking the tar out of D2 :) (In response to the post below this one).
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Yay! It looks like I have found a cheap method to prevent shadows from going through walls in most cases. It's rather a kludge, but it's good enough and no performance killer.
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

I've already taken a bit of footage from DXX, and I planned on having it fade to LOR. I was also going to use levels like Alhambra, Speed!, and Warp Shockwave to show off the other features. I'll try out your suggestions, too.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Alhambra? Oh well ... actually that's one of my early levels ... I spent a lot of time on it, and it may have something to it, but I don't think it's all that great ... :roll:

But ofc this is entirely up to you and your artistic freedom. :)
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

Was \"clip shadows\" the big performance killer you were talking about? Because I turned that on after downloading the new version, and the levels look much better. It does kill my performance a bit, although that may be working in tandem with the cranked up smoke effects.

It's so good looking, it slows down my computer. Sweet. :D
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

No, it was not. Shadow clipping is the compromise working acceptably fast while still yielding good looking shadowing. The slow down I was talking about was like 1 fps on a really good machine. ;)
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

Deidel, if you ever get the Polytron source code, remove pmv. I'm on the border of classifying that as malware. Just because I closed Polytron doesn't mean pmv closed. And if I have one instance of that running and I don't know it, I can't run games.

Back to work.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

-> Task Manager ;)

Btw, if working on a model, it is helpful to move all submodels away from the main model 2 - 5 units before moving their points into model 0.

I will now do the Fireboss and then have all bots up to & incl. D2:Level 8 done. :D
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

I've been doing the task manager thing since I realized it was pmv's fault.

And yes, I generally move bits I need to work on away from the main model before I work.

And the reactors for each system still need to be done.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Ummm ... you could do the reactors, how 'bout it? :)

Another hint: Mark all vertices (shift+v) to easily find unused or not (completely overlapping) duplicates in the 3D view.
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

At the rate you're going, you could have the whole game done by the end of next week. I still need to fiddle with the system 7 models. :D

Yeah, I'll do the reactors.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

CDS,

I have a proposition: I am *really* fast with rebuilding the models, but I don't fix any texture flaws I introduce. Because of that I am currently using the models only for shadow creation although they're way better built than the originals and mostly have less faces and vertices (hence render faster with OpenGL style lighting, which computes light per model vertex).

Would you mind taking the models from d2x-xl.hxm and reskin them properly? Need not be a perfect job, just the proper textures at the proper places and halfway well aligned.

That would be a great help. :)
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

Sounds like a plan; you fix the polys, I fix textures.

Should I send you what I've done with the system 7 models? Most of the polys are fixed, except for a few rogues. Haven't gotten to Boarshead yet.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

yeah, send them (.pol files packed in zip/rar, to karx11erx at hotmail dot com. Please use a meaningful text in the e-mail header, or it might end in my spam folder ;)).

I have fixed textures on a few models, and some default models are actually ok (the simple ones: IT Droid, Omega). Very few though.

I first extracted all default models to an extra folder, then fired Polytron up twice - one to examine defaults, other to fix new models.

Did you notice that in the 3D view the model appears mirrored compared to the isometric front view? You need to know that when aligning faces, particularly eye textures composed of several polys.

Actually, the bot textures are even more lores than the D2 wall textures, as Parallax had packed several textures into one 64x64 package. If put on a model, usually the textures are even stretched to create a less grainy look (in Polytron that would be the 'shrink face' feature in the alignment/polygon mode).

I have fixed the Thief and the Fireboss, that's all. You can do a (slightly or not - up to you) different skinning job if you want to, it should just look acceptable (not necessarily perfect - it is somewhat hard to perfectly align with Polytron, as you apparently cannot change u,v for single vertices - or maybe you can, using the direct u,v adjust?).

To inspect a new model in D2X-XL, add -alt_models 1 to enable full rendering for the new models and -nobotai to freeze the bots. Create a simple level with just the bot you work on and a player position in it (I can also send you such a level if you want, got one already).
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Just did the Alien 1 boss:

Default model: 290 vertices, 191 polys
Fixed model: 160 vertices, 159 polys

And to think that I even had to add some polys for the gun muzzles and around the eyes!

Often the default models have very tiny polygons at corners of the model, so tiny they almost are a vertex themselves. These can all be deleted.

Boarshead - old: 102/85, new: 62/63
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

I *think* I'm done with the D1 reactor. I can't tell, because real-time shadows crapped out on my machine. I left a bug report on Sourceforge.net.

And when I updated the video drivers, D2X-XL wouldn't work at all.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Sheesh. :?
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

You fixed it, don't worry.
User avatar
Kyouryuu
DBB Alumni
DBB Alumni
Posts: 5775
Joined: Fri Apr 30, 1999 2:01 am
Location: Isla Nublar
Contact:

Post by Kyouryuu »

You know, it's kind of amusing, because the issues you face here are exactly the same with Unreal Engine 3. ;)

UE3 offers both stencil shadows (the ones in Doom 3) that modulated shadows (the ones in Half-Life 2). The former only works well if you have perfectly closed models, which includes faces unseen such as the bottoms of trees and pipes that are usually stripped out for performance reasons. The latter is less expensive, but has the problem of casting on multiple surfaces as you have noted. :lol:

Either way, shadows can be a tricky problem to solve.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

The real problem with stencil shadows is the severe performance penalty if you have many lightsources. Basically you have to make a complete render pass per light source, computing lit and shadowed areas, and accumulate each render for the final result. With 50+ light sources, D2X-XL slows down to a crawl this way.
User avatar
Shadowfury333
DBB Ace
DBB Ace
Posts: 326
Joined: Mon Aug 09, 2004 8:36 pm

Post by Shadowfury333 »

Diedel, if you ever want to try out soft shadows, This site seems to have a lot of information. It may also have info on efficient stencil shadows, but I haven't looked for it. Either way, I just thought I'd let you know, even if it is just for more information on shadow rendering in general.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

I am just trying to implement soft shadows. I need to get a screen copy for this, and for some reason yet unknown to me that copy has errors. That's why I cannot procede. But I will definitely look into that site, thx. :)

Edit: I know that site. Impressive. They are offering an entire renderer though I have understood them right. Not an easy task to transfer D2X-XL to using it.
User avatar
Kyouryuu
DBB Alumni
DBB Alumni
Posts: 5775
Joined: Fri Apr 30, 1999 2:01 am
Location: Isla Nublar
Contact:

Post by Kyouryuu »

Well, what you might try to do as a work around is to create a special directional light object that is global to the entire mine. All shadows would then base their orientation on this light, instead of every other light in the mine. Conceivably, it might be possible to have multiple instances of these lights that you can turn on and off (so only one is ever active) to change shadows.

This is something we've had to do in other games. Lights that produce dynamic shadows are always costly, so you try to get away with only one and hope the player doesn't really notice. In many cases, they don't care.

Another option that could be a compromise solution would be to let the designer mark different light sources in the mine as \"dynamic.\" The light nearest the ship with this flag would be the basis for casting shadows. It's up to the user's discretion, then, how frequently to use dynamic lights.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

For proper stencil shadow rendering, the geometry has to cast shadows too. With only one global light, in Descent levels ppl would notice very soon that something is wrong.

I had a compromise of only using a few lights for shadow casting, but performance still dropped below acceptable levels. And I had other rendering problems, e.g. accumulating the color info didn't work.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Some polymodel stats (vertices/polys before -> after remodeling):
  • Hulk (Descent 1): 121/114 -> 81/88
  • Advanced Lifter (Descent 1): 120/92 -> 84/85
  • Guidebot: 72/53 -> 22/29
  • Boarshead: 102/85 -> 60/62
  • Diamond Claw: 124/100 -> 80/90
  • Sidearm: 147/108 -> 98/92
  • TRN Racer: 192/146 -> 88/102
  • Ice Boss: 150/152 -> 116/110
  • Alien Boss 1: 290/191 -> 160/159
  • Alien Boss 2: 286/246 -> 115/181
  • Fiddler (Vertigo): 157/120 -> 97/93
  • S.P.I.K.E. (Vertigo): 89/111 -> 64/97
  • Canary (Vertigo): 112/130 -> 51/84
  • Red Guard (Vertigo end boss): 241/257 -> 125/193
From what I've seen it looks like there were two people building the models. One seems to have been pretty skilled, cleanly built models, few extra polygons, no unused vertices. The other guy's models were really crappily built: Lots and lots of extra polygons, triangles composed of multiple smaller trianges, tiny polygons used to fill up corners of the model instead of simply using one big polygon, excess vertices, duplicate vertices (two different vertices with almost the same coordinates), resulting in open model hulls ... these models were hell to rebuild.
User avatar
Chaos Death Saurer
DBB Ace
DBB Ace
Posts: 97
Joined: Wed Aug 23, 2006 8:10 am

Post by Chaos Death Saurer »

I heard that. (looks at D2 Final boss)
Post Reply