Shadowing discussion (Valin Halcyon)

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

Moderators: Grendel, Aus-RED-5

Post Reply
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Shadowing discussion (Valin Halcyon)

Post by Diedel »

Valin,

here are two screenshots of the polymodel shadowing.

Shot 1 shows the model body (blue) and shadow volume (orange). Both look very good to me.

Shot 2 shows the resulting shadow. For some reason I cannot figure, the stenciling hasn't grabbed all model faces (e.g. the thruster faces).

Image

Image

Edit:

For some reason, it is not properly determined which polygons face the light source and which don't. I have checked the surface normals and everything looks good there. :?

Edit 2:

I think I have it. The model data is indeed partially bogus. Some seemingly triangular or rectangular faces have 6 or 7 vertices and look like they're folded along one of their edges. Totally whacked. The guy who built the lo-res pyro model did a really bad job here.
User avatar
Peter
DBB Ace
DBB Ace
Posts: 71
Joined: Fri Sep 20, 2002 2:01 am
Location: Austin, Texas
Contact:

Post by Peter »

Whoah sweet! Shadows! That is funny that the original model is screwed up.
halprin
Another one bites the dust!
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

I think I might be able to fix this in D2X-XL (by removing the parts of the foul polys that face the ship's interior), but I will have to try this before I can say anything definitive.
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

Glad you found a possible solution. I figured it'd be either setup a bit of a hack to use the existing mesh data with volumetric shadows, or use shadow maps.

It's likely you'll find some of the similar issues with the D4 GX, as I told you yesterday, it wasn't really a final version and contained several minor mesh glitches, especially where the verts and polys don't mirror at all left to right, the nose being an excellent example.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Minor glitches aren't a problem, but polygons folding behind themselves ... tsk, tsk. Exactly the thruster poly is a blatant example. Actually, it's a square, but in the model it has 7 vertices, forming a second square behind the outer one, also facing outward.

Btw, I had a view of the pyro like a porcupine, with all the normals sticking to it ... heh!
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

Oh, the pof and oof formats use some faces in the model format as gunpoints and engine glows etc...certain you're not trying to render these \"hidden\" faces and that's causing the problem?
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Engine glows aren't hidden polygons. Afaik they're simply polygons with a special light value (I may be wrong, but that's what I concluded from the code). This does not touch the problem of folding polygons.
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

In the oof model, engine glows are usually a 3 vert face. If you get them flipped backwards..the engine plumes go through the ship and out the front instead. We got that glitch during the D4GX's development. :P
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

As far as I can remember, there were no glow faces in the D4 Pyro.
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

erm..there *should* have been..if not, then you got a bad model. Go to pd.com and go into the D$ files section, you aught to find the modified apparition level I made with a polished D4GX in oof format, and I KNOW it has engine glow faces...they glow white.
User avatar
Top Gun
DBB Master
DBB Master
Posts: 8099
Joined: Wed Nov 13, 2002 3:01 am

Post by Top Gun »

Stencil shadows!?! :shock:

Just don't show that to the FS2 SCP coders. Someone implemented an experimental build with stencil shadows months ago, but it never went anywhere. :P
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

Valin,

please post a direct link to the D4 Pyro oof file. I am not gonna fiddle it out some mission or whatever. :)

Top Gun,

shadowing in D2X-XL is dead. The models aren't good enough. When projecting faces to infinity for the shadow volume, you get huge gaps. I also cannot figure why the front cap doesn't arrive in the stencil buffer. I am done with this sh1t.

Edit:

I will try a take on shadow mapping. Maybe that will work. Depending on how I set it up, it can cost a lot of performance though, as you have to render the full scene as seen from the lightsource for every light source.
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

I no longer have the tools to do so, Diedel. I actually don't remember how. :P The original OOF that went into the level is on my PC, but as it's currently offline and not on hand to scavenge the hard drive from, I can't get at it for awhile. I could get it to you later once my own machine is back online.

EDIT: Erm, Diedel? I was just looking at the orange/blue screenshot again. Where exactly is the lightsource at? It LOOKS like it's actually INSIDE the ship...

Also, shadow mapping won't kill performance that badly if you do it in native OpenGL as much as possible. Nvidia and ATI both have developed that capability in hardware rather extensively, according to Rob, and is likely to be the \"future\" of shadowing, short of using shaders for shadowing.
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

For shadow mapping, for each light source taken into account, you will have to render the scene as seen from the light source. You can probably render directly to texture, but it's still a full render pass for each light. You will do a special render only giving you depth information -> shadow map. Then you have to merge all the shadow maps created that way with the regular scene in another render pass. Now I have to render shadow maps for all objects whos shadows are visible, and do that for the lights that affect each object most. That can easily amount to several dozen light sources. Level 1 of D2:CS alone contains 135 lights!

I cannot pull this off either, as you have to project the shadow maps so that they look right if seen from the actual viewer position, and I don't know how to do it, and cannot figure it from the tutorials and documents I've read (you may guess it: I have tried to get shadow mapping into D2X-XL). They all refer to OpenGL and GLU calls, and I'd need the basic 3D math explained first. I am constantly so tired that I just cannot think enough. I also don't know how to merge multiple shadow maps with the scene. There is no really good OpenGL course on the inet I'd know of that would teach such enhanced things, and I cannot pull it together from information bits and pieces and OpenGL references (which are poor as hell as far as I know them), because they don't even tell you what all the stuff is actually good for. You have to know the answers already. Oh yeah, and for the kind of light sources in D2, you'd need to implement hyperbolic (I think that was the term) shadow mapping to make it look good.

D2X-XL eats too much of my time, and yields too little for what I put in it.

I'd need someone who really knows how to code such stuff and would be willing to poke around in D2X-XL a little, with my support where needed. If Chris would take a look in D2X-XL and simply fix the stuff I would be more than happy ... but I doubt he would. :roll:

Oh well, I have a life at last.
Valin Halcyon
DBB Admiral
DBB Admiral
Posts: 1113
Joined: Sun Jan 02, 2000 3:01 am

Post by Valin Halcyon »

LOL..Chris? He's too busy with Supreme Commander to help at all.

Rob might be of use, I'll ask him when I see him again. I might even get lucky and get him to do it for us...or at least explain it for you. :)
User avatar
Diedel
D2X Master
D2X Master
Posts: 5278
Joined: Thu Nov 05, 1998 12:01 pm
Contact:

Post by Diedel »

It can't be so hard to do. I have implemented most of the code already, it just needs some fixing ... so it probably isn't such a tremending amount of work left to be done. ;)
Post Reply