Light per Pixel

LightTest code is done for now. Test it here (needs DX9, PixelShader 1.2, VertexShader 1.1, 4 TextureStages, A8R8G8B8 Texture-RenderTarget. It works on my Geforce4, should work on a 3 as well. Probably Newer ATI-cards, too). Features:

  • 4 textures w/ 4 combiner-stages (i.e. should run at a minimum of 50% max fillrate)
  • lighting performance independent of # vertices of object
  • attenuation from light -> object and object -> viewer (no fog needed, ambient retained)
  • ambient is done with filtered HDR cubemap (i.e. depends on normal!)
  • different attenuation for diffuse and specular light (from object -> viewer)
  • directional and point-lights
  • decal texture + glossmap
  • per pixel diffuse + specular [attenuated for point-lights] (limited to about 6 point lights + 7 directional lights = ~13 per pixel lights!)
  • specular power is not fixed in pixel shader
  • accurate reflection vector calculation, no halfway vector cheating
  • approximates elliptical objects (for point light attenuation)
  • specular color is always the same as the diffuse color of a light

Comments? Queries?

Leave a Reply

Your email address will not be published. Required fields are marked *