Broken stencil shadows for scaled objects

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
Eugene
OGRE Team Member
OGRE Team Member
Posts: 185
Joined: Mon Mar 24, 2008 4:54 pm
Location: Kraków, Poland
x 41

Broken stencil shadows for scaled objects

Post by Eugene »

In finite extrusion case for stencil shadows it`s important to extrude shadow volumes so that dark (farest) cap is not clipped or zFail algorithm will fail and additional big strange shadow would appear on the screen.
Finite extrusion case happens when you use custom projection matrix for example to make high quality screenshots with resolution higher than supported by videocard.
Therefore, as shadow volumes are generated in object space and extrusion distance is limited by zFar in world space, this extrusion distance limit should be converted to object space before usage.
Additionally ACT_SHADOW_EXTRUSION_DISTANCE variable is (perObject|perLight) instead of (perLight) as it already uses perObject world matrix to unapply scale.

Corresponded patch is located here: https://bitbucket.org/eugene_gff/ogre-w ... c9632b3b68