This section compares the features included in this demo with the features that were planned to be included in the original design document.
The following features were specified in the design document and have been completed:
-
Shaders using GLSL
Shaders have been implemented using GLSL. See the GLShader class for more information.
-
Render-to-Texture
In the design document, Render-to-Texture involved using glCopySubImage2D. This was accomplished, though performance could have been boosted using OpenGL's framebuffer objects. However, some testing was undertaken but there was no more time to implement framebuffer objects. See GLRenderTarget for more information.
-
Deferred Shading
Deferred shading was accomplished, but the implementation differed from the original design. The design specified rendering a light pass for each light to a render target, but the current implementation writes straight to the framebuffer using glBlend and a blend mode of glBlendFunc( GL_ONE, GL_ONE ), accumulating light values straight onto the buffer. This is copied to a single lit scene pass, which is multiplied with the diffuse to produce the final rendered scene. The lightmod.shader shader combines the two passes.
-
Phong Illumination for Point Light Sources
Phong illumination was achieved for point lights and normal mapped surfaces. See normalpoint.shader for more information.
-
Normal Mapping
See above.
-
Phong Illumination for Spot Light Sources
Phong illumination was achieved for spot lights and normal mapped surfaces. See normalspot.shader for more information.
-
Shadow Mapping for Spot Light Sources
Shadow mapping was done by rendering the depth from the light's point of view and using this map for depth comparisons in the light shader. See GLSpotLight and normalspot.shader for more information.
-
Projected Textures
When performing the shadow calculations, it was trivial to sample a normal texture map too. This was done in the normalproj.shader.
-
HDR & Bloom
HDR was not implemented, but bloom was done by rendering the scene to a smaller buffer and then Gaussian blurring it horizontally and vertically. See bloomprep.shader, blurpph.shader and blurppv.shader.
-
Reflections
Reflections were achieved by rendering a cube map from the position of the entity. The cube map was then sampled in a seperate pass. See cubereflect.shader, cubereflectnormal.shader, cubereflectshinymap.shader and cubereflectshinymapnormal.shader.
The following features were on the "optional" list of features in the design document and have been completed:
-
Soft Shadows
Shadows were softened using a Gaussian blur kernel. See normalspot.shader for information.
-
Motion Blur
This was a last minute brainwave. I realised that motion blur can be possible by rendering the difference between each vertex over two frames as a colour value and using this as a blurring coefficient. When rendering the motion vectors, the previous modelview matrix is passed in for each object, and the distance is computed between that and the new position of the vertex. Then this is transformed into screen space and used as a bias for the blur. It has been implemented in motionblur.shader and also integrated into motionblurdof.shader which incorporates/replaces the depth of field shader. Unfortunately no screenshot is available as it is impossible to capture one. However, the effect is prominent when moving the view sharply with the mouse.
-
Gloss Mapping
A specular map can be used to control the glossiness of a surface. See cubereflectshinymap.shader, cubereflectshinymapnormal.shader, cuberefractshinymap.shader and cuberefractshinymapnormal.shader.
-
Refraction
Refraction was achieved similarly to reflection. The same cube map was sampled, but the final shader used a refraction calculation to sample the map instead. A Fresnel term is also added to the effect for more pleasing results. See the cuberefract.shader, cuberefractnormal.shader, cuberefractshinymap.shader and cuberefractshinymapnormal.shader.
-
Depth of Field
This effect was accomplished by rendering the scene to a depth render target. The depth was sampled at the centre of the image as well as for each fragment, giving a focal point and a depth value which were used as a blurring coefficient.
-
Animation
Simple animation was achieved by having objects follow a set path over time, or spinning on the Y axis.
The following features were in the design document, but were removed for the following reasons:
-
Billboarded Sprites
These were removed as they were not entirely relevant to the GLSL demo. Overriding the GLGeometry class and using the inverse view matrix could be easily managed.
-
Shadow Mapping for Point Light Sources
The process is in place, but not finalised. Due to the limitations of texture units, I didn't have time to split the shadow mapping into two more passes.
-
HDR
This was not done simply due to time constraints.
The following features were not planned, but would have been worthy additions:
-
Parallax Mapping
This is generally agreed to be only useful for very bumpy brick textures.
-
Directional Lights
Having point and spot lights covered was sufficient.
-
Anti-aliasing
Anti-aliasing was achieved, but was incompatible with later changes to the rendering system. It could be easily added, but not in the current timeframe.
Generated on Fri Mar 23 12:55:03 2007 for glsldemo by
1.5.1-p1