1 | /** |
---|
2 | Implementation of Deferred Shading in OGRE using Multiple Render Targets and |
---|
3 | HLSL/GLSL high level language shaders. |
---|
4 | // W.J. :wumpus: van der Laan 2005 // |
---|
5 | |
---|
6 | Deferred shading renders the scene to a 'fat' texture format, using a shader that outputs colour, |
---|
7 | normal, depth, and possible other attributes per fragment. Multi Render Target is required as we |
---|
8 | are dealing with many outputs which get written into multiple render textures in the same pass. |
---|
9 | |
---|
10 | After rendering the scene in this format, the shading (lighting) can be done as a post process. |
---|
11 | This means that lighting is done in screen space. Adding them requires nothing more than rendering |
---|
12 | a screenful quad; thus the method allows for an enormous amount of lights without noticable |
---|
13 | performance loss. |
---|
14 | |
---|
15 | Little lights affecting small area ("Minilights") can be even further optimised by rendering |
---|
16 | their convex bounding geometry. This is also shown in this demo by 6 swarming lights. |
---|
17 | |
---|
18 | The paper for GDC2004 on Deferred Shading can be found here: |
---|
19 | http://www.talula.demon.co.uk/DeferredShading.pdf |
---|
20 | |
---|
21 | This uses a heavily hacked version of the Ogre PostProcessing framework by Manuel. |
---|
22 | ******************************************************************************* |
---|
23 | Copyright (c) W.J. van der Laan |
---|
24 | |
---|
25 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
---|
26 | this software and associated documentation files (the "Software"), to deal in |
---|
27 | the Software without restriction, including without limitation the rights to use, |
---|
28 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
---|
29 | Software, and to permit persons to whom the Software is furnished to do so, subject |
---|
30 | to the following conditions: |
---|
31 | |
---|
32 | The above copyright notice and this permission notice shall be included in all copies |
---|
33 | or substantial portions of the Software. |
---|
34 | |
---|
35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
---|
36 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
---|
37 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
---|
38 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
---|
39 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE |
---|
40 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
---|
41 | ******************************************************************************* |
---|
42 | */ |
---|
43 | #ifndef H_WJ_LightMaterialGenerator |
---|
44 | #define H_WJ_LightMaterialGenerator |
---|
45 | |
---|
46 | #include "MaterialGenerator.h" |
---|
47 | |
---|
48 | class LightMaterialGenerator: public MaterialGenerator |
---|
49 | { |
---|
50 | public: |
---|
51 | LightMaterialGenerator(const Ogre::String &language); |
---|
52 | }; |
---|
53 | |
---|
54 | #endif |
---|