Simon’s Graphics Blog

Really Old Demos - OpenEngine

· Read in about 2 min · (406 Words)
DirectX demo code

This demo is just here for posterity - it formed part of my August 2002 coding portfolio when I was first applying for jobs in the games industry. Be warned, there‚Äôs some seriously dodgy coding going on here…

I started writing an open rendering system for DirectX 8. After getting a job I haven’t had the time to take this any further, but I”ll keep the code and demo hosted here for the time being.

Screenshot

Screenshot

The screenshots show a grid of cubes lit by a single spotlight. This demo demonstrates per-pixel attenuation, bumped diffuse response, bumped specular response and hardware shadow mapping.

How It Works

The frame is rendered in five passes, and represents the worst case pipeline in the rendering system I’m currently working on. The passes for the single spotlight used in the demo are:

  • Render an ambient pass of the whole scene.
  • Render the attenuation modulated with spotlight intensity (a projected texture) and the shadow map into the framebuffer alpha.
  • Additively render bumped diffuse response using the normal map and light position into the frame buffer, modulated by destination alpha and light colour.
  • Render the diffuse texture into the frame buffer, modulating against the destination colour.
  • Additively render bumped specular response using the normal map and light position into the frame buffer, modulated by destination alpha, light colour and specular intensity.

This gets slightly more complicated for multiple lights, since the frame buffer alpha gets overwritten (although it can be saved once by rendering the specular in reverse order to the diffuse). The nice parts are:

  • Static lightmapping can be done as part of the ambient pass.
  • Other lights (point, directional or cube lights) are much simpler to render.
  • Detail texturing can be essentially done for free in the diffuse texture pass.

Downloads

This application requires Windows 2000/XP, DirectX 8.1 and a GeForce3 class card or above.

oedemo-binary.zip

The source code requires Visual Studio 7, the DirectX 8.1 SDK, nvasm 1.42 and boost 1.28.0 or above to compile. The textures required for the demo aren’t included in the zip; download the binaries to get the textures.

oedemo-source.zip

Please note that this source is work in progress and as such is incomplete in lots of areas. I’ve made it available now so that people interested in rendering the same sort of effects can look at a working implementation to get some ideas.

Acknowledgements

Comments