I’m currently adding vertex program extrusion into the mix, which is giving me some frame rate improvements with stencil shadows. I also have to sort out infinite far plane projection otherwise in zfail mode the dark caps get culled, since they are being projected to infinity in the vertex program. I have a weird corruption of the volume when using vertex programs on skeletally animated meshes in release mode right now, that’s puzzling me a little since they’re fine in debug mode and non-animated meshes are fine in release mode.

Read more →

Modulative texture shadows are done, they now work with directional lights and spot lights, and have some nice fade-out features meaning that the shadows fade out in the distance for directional lights, and fade out around the edges of the spotlight range for spotlights - the latter is really important since the clamping on the shadow texture would cause horrible ‘smears’ to appear on other geometry when casters hit the edge of the texture.

Read more →

Texture shadows are fundamentally working, as you can see from this forum topic. I still have to sort out the blending so that it’s not just black & white but composited on top of the existing shadow receivers. Also, the positioning of the projector / render to texture camera is not automatic yet, I’ll have to sort that out. GL projection appears to be upside down right now, which looks like a texture matrix issue.

Read more →

The last few days have been a bit fragmented, I’ve added a few additional optimisations like being able to make shadows turn off at a given distance, and I’ve implemented the D3D versions of projective textures. Ogre could actually do projective textures before, it was just a little awkward. Now you can just attach a Frustum object to the texture unit, and it does it all for you, which is pretty slick.

Read more →

It’s been a good couple of days 😀 temas indeed did fix the GL modulative shadows issue. And I woke up this morning with one of those ‘perfect clarity’ moments, where I just knew what the cause of the remaining 2 GL shadow bugs were. REM sleep, I owe you one. The tough part was going through the whole day at work knowing what it was, but not being able to test it until I got home.

Read more →

GL shadow issues

Well, I fixed the GL light state problem, and temas seems to be close to fixing the manual blend problem so we’re getting there on GL shadow support. The outstanding issues (and these are GL only, D3D does not experience them) are: Animated meshes have problems with shadow extrusion. — Both software and hardware skinned meshes have extrusion artefacts with more than 1 submesh (test case: ninja.mesh). Software blended meshes with one submesh work fine

Read more →

Today I implemented additive lighting & shadows, ie a more realistic (and more expensive) technique where multiple lights and their shadows can be combined more realistically. You can see my initial results in this screenshot. Basically we have to split or categorise every pass into an ambient, per-light or decal pass, and build up the lighting in the scene by rendering the ambient passes, then rendering per light whilst masking out shadowed areas, then render the textures over the top.

Read more →

Heh, I guess that’ll teach me to speak too soon. I was so sure my new shadow culling system was working last Tuesday, but in fact there was a bug which caused shadows to be prematurely culled. I spent ages tracking it down, thinking it was in the cull volume building, so I added debug volumes and tried lots of things - in the end it was a simple error in Frustum::getWorldCorners which I hadn’t noticed before because it had no discernable effect on previous usages of it.

Read more →

Shadow optimisations

Wow, something actually went quicker than I expected for a change! 😀Tonight I polished off the shadow caster elimination code I’ve had in my head for a while - previously the location of shadow casters was pretty basic - since obviously objects which are not in the camera’s frustum can still cast shadows into the view there is an issue of how you efficiently locate all objects which can be casting visible shadows.

Read more →

I finally nailed some of the more annoying problems I’ve had on my TODO list - it turns out the lack of shadows when hardware skinning (which actually caused GL to crash in the driver - yuck), were due to a feature I put in, but forgot about. :/ I wanted to suppress the update of a shadow buffer to the hardware version when only doing the software vertex blend because of the shadow, because otherwise you would unnecessarily upload the buffer twice.

Read more →