Self-shadowing support with #PB_Shadow_TextureAdditive

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Self-shadowing support with #PB_Shadow_TextureAdditive

Post by Olby »

Self-shadow support with #PB_Shadow_TextureAdditive would be really useful since stencil shadows are heavy on performance and can not be blurred.
More so a command to enable/disable self-shadowing is necessary. Occasionally objects might look ugly when self-shadowed (for example stencil shadows + spheres) so it is important for developers to fine tune this.
OGRE Reference Manual wrote:Shadow Casters and Shadow Receivers

To enable texture shadows, use the shadow technique SHADOWTYPE_TEXTURE_MODULATIVE or SHADOWTYPE_TEXTURE_ADDITIVE; as the name suggests this produces Modulative Shadows or Additive Light Masking respectively. The cheapest and simplest texture shadow techniques do not use depth information, they merely render casters to a texture and render this onto receivers as plain colour - this means self-shadowing is not possible using these methods. This is the default behaviour if you use the automatic, fixed-function compatible (and thus usable on lower end hardware) texture shadow techniques. You can however use shaders-based techniques through custom shadow materials for casters and receivers to perform more complex shadow algorithms, such as depth shadow mapping which does allow self-shadowing. OGRE comes with an example of this in its shadows demo, although it’s only usable on Shader Model 2 cards or better. Whilst fixed-function depth shadow mapping is available in OpenGL, it was never standardised in Direct3D so using shaders in custom caster & receiver materials is the only portable way to do it. If you use this approach, call SceneManager::setShadowTextureSelfShadow with a parameter of ’true’ to allow texture shadow casters to also be receivers.

If you’re not using depth shadow mapping, OGRE divides shadow casters and receivers into 2 disjoint groups. Simply by turning off shadow casting on an object, you automatically make it a shadow receiver (although this can be disabled by setting the ’receive_shadows’ option to ’false’ in a material script. Similarly, if an object is set as a shadow caster, it cannot receive shadows.
http://www.ogre3d.org/docs/manual/manua ... re-Shadows
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Self-shadowing support with #PB_Shadow_TextureAdditive

Post by Bananenfreak »

+1 for a realistic world :)
Image
Post Reply