Arkamarante / collision-domain

Automatically exported from code.google.com/p/collision-domain
0 stars 0 forks source link

[Lighting/Shader] Shadowing #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Feature: Shader based shadowing method

Purpose of feature addition: Improved shadows and greater efficiency.

Work involved: Currently we use stencil shadows which are calculated at the 
polygon level. These produce accurate shadows but are very expensive and do not 
work on transparent textures, as used for leaves (as they work with geometry).
The proposed improvement is to use Texture shadows which are calculated at the 
shader level so take into account textures and are a lot cheaper. Pure texture 
shadow mapping allows objects to only send or receiver shadows, so self 
shadowing is not possible. The solution is to use a shader technique to do a 
caster and receiver pass on every object.
Currently two such methods are implemented:
1) Depth Shadowmapping (DSM) with Percentage Closer Filtering (PCF) and Light 
Space Perspective Shadow Mapping projection (LiSPSM). This works but produces 
very poor shadows.
2) Parallel Split Shadow Mapping (PSSM) using LiSPSM for projection. This works 
but produces very faint shadows and the camera appears to lighten and darken as 
the camera rotates. I think this is due to the splits being inadequate, the 
next step would be to render out the splits to a texture and see what they look 
like.
An alternative would be to look into Variance Shadowmapping (VSM) optionally 
with Percentage Closer Soft Shadows (PCSS), though neither of which are as well 
documented with Ogre.

The main issue here is that any technique requires a huge amount of work and 
there is no 'out of the box' working solution.

The following links will be useful:
PSF: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=51214
DSM: 
http://www.stevestreeting.com/2009/01/04/depth-shadow-mapping-dx9-depth-range-go
tchas/
DSM: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=58845
DSM: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=46826
PSSM: http://www.ogre3d.org/forums/viewtopic.php?f=1&t=65980&start=25 (entire 
thread is useful, but the code in post 26 is most useful).
PSSM: http://www.ogre3d.org/forums/viewtopic.php?f=5&t=68512

Overview of custom shadow mapping: 
http://www.ogre3d.org/tikiwiki/Custom+Shadow+Mapping&structure=Cookbook

NB: The wiki article for DSM is highly inefficient and should not be followed.

Original issue reported on code.google.com by JonathanSimmonds on 17 Feb 2012 at 11:37

GoogleCodeExporter commented 8 years ago

Original comment by JonathanSimmonds on 20 May 2012 at 10:31