Skip to content

Many Lights

Narta Xaymar Dirks edited this page Oct 29, 2026 · 2 revisions

Many lights

Blitz3D uses the fixed function lights of Direct3D 7, which are limited to eight for the whole scene: the lights after the eighth do nothing. BlitzLLVM keeps up to 127 visible lights per camera and gives every draw its own set of eight, chosen on the CPU when the draw is made. A light is rated by its brightness (the color of LightColor) times its attenuation (range over distance) at the closest point of the sphere around the entity's box, which is the most it can do anywhere on the entity, and the eight with the highest rating are used. Negative lights, which darken, are rated by the size of their color, so a strong one is not left out for a weak positive one. Lights that do almost nothing there (the rating is below 1/512) are left out, and directional lights are rated by their color alone.

With EntityLightChannel only the lights that share a channel with an entity are rated for it, so lights of other channels never use up one of its eight. Planes, terrains and fullbright entities take the first eight of the lights that share a channel with them.

A scene with eight lights or fewer is lit exactly as before, and a program written for the original behaves the same unless it has more than eight visible lights. Entities without a box (planes and terrains) and fullbright entities are not rated: planes and terrains use the first eight lights. Spot cones are not taken into account in the rating. The lights are not part of the batching: draws that are the same in everything else still merge into one call, as each instance carries its own set of lights. Order and blending of see-through things are not changed.

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally