User Submitted Code Samples - Page 7

Deferred Shading (DirectX 9.0 - C++)
 

Author: Nikita Kindt

This sample demonstrates how to use Deferred Shading with Direct3D 9. The idea behind Deferred Shading is not really new and was first introduced by Michael Deering at SIGGRAPH 1988. The theory is simple: render all data of the geometry like position, normals, diffuse map, environment map etc. to multiple render targets and apply lighting later as a postprocess. While lighting is computed the multiple render targets are used to read out the data stored previously and render the final colors to a plane which covers the entire screen. The Deferred Shading technique brings few optimizations but has also some disadvantages. While Deferred Shading needs a high-end GPU (floating point textures / multiple render targets) which guarantees the incompatibility to older hardware it can be used to perfectly batch rendering. Details about various advantages/disadvantages are mentioned later in the code.

 

Soft Shadow Volume (OpenGL - C++)
 

Author: Andreas Jonsson

This demo demonstrate how you can create a shadow map from the stencil shadows and then blur it to make it soft. This demonstrates only the basics. For more advance applications you should not just blend the shadow map on to the screen. You should use it when you calculate per-pixel lighting. The shadow map tells you where, and how much that light affects a certain area. "If you want fading shadows" like Doom3. (but soft) You need to create one shadow map for each light. Pleas notice that this is not a 100% accurate soft shadows. It is very obvious in this demo. But if you add textures and more advance lightning. The result is quite good. You can find a more advance demo on this topic on my website.
 

 

Introduction to Newton for Physics (OpenGL - C++)
 

Author: Anudhyan Boral

This sample demonstrates how to setup and initialize the Newton Physics API for realtime physics simulations. This shows only the basics of what Newton can do. A box is rendered onto the screen with a specific mass and inertia. The box is given an angular velocity on startup and is seen to slow down to a halt eventually. Pressing F1 gives an additional 'push' to the box. More demos and the complete sdk can be found here.

Relevant Keywords: NewtonWorld, NewtonBody, NewtonCollision, NewtonCreate, NewtonCreateBox, NewtonCreateBody, NewtonReleaseCollision, NewtonBodySetMassMatrix, NewtonBodySetMatrix, NewtonBodyGetMatrix, NewtonBodySetOmega, NewtonBodyGetOmega, NewtonUpdate, NewtonDestroy.
 

 

Antialiasing with OpenGL (OpenGL - C++)
 

Author: Simon Flannery

A very simple sample demonstrating how to use the hardware anti-aliasing capabilities under OpenGL.

 

Loading DDS Texture under Linux (Linux - OpenGL - C++)
 

Author: Andreas Jonsson

This sample demonstrates how to load DDS textures under Linux, without using any DX headers.