More DrawBlankLight natives (DrawVolumetricSpotLight, DrawCapsule)

At the moment the game has the following natives:
DRAW_SPOT_LIGHT
DRAW_SPOT_LIGHT_WITH_SHADOW
DRAW_SPHERE
DRAW_LIGHT_WITH_RANGE (Point Lights)
DRAW_LIGHT_WITH_RANGE_AND_SHADOW

These are nice however there are some holes:

  • You cannot do volumetric lights at all
  • You cannot do capsule lights at all
  • You cannot do emitted textures

You can get by with using SetObjectLightColour but it’s performance can get to catastrophic levels of eating 3ms per frame just for setting about two dozen lights colours as it iterates over every single active light instance in the entire scene for every call. This is bad enough that rockstar staggers it to a very visible degree in GTA Online.

Things you cannot do as is:

  • Smooth spotlight radius adjustments (unless you want to make 50 props with different parameters and create/destroy them every frame (this would stink))

In the interest of making some highly programmable lights, the best avenue i can see is just offloading this to one frame natives that draw it with the appropriate parameters as needed. From what i could gather the logic is fairly modular and it should probably be doable to add these without too much trouble. Only thing that might be iffy is the emitted textures which is not make or break.

Mainly, i just want to be able to control volumetric spot lights. and maybe draw capsules to emit some light from some other types of fixtures.

Clips for reference of what i want to do but cant really go too far with due to limitations or performance concerns:
Below eats 3ms a frame and i would love to do more than this, i also cannot tweak the volumetric parameters or the radius at all. And im sure this would be even worse on lower end PCs and thats not even accounting the render toll this already would take.

1 Like

This is a nice suggestion, I already tried adding the DrawVolumetricSpotLight but I didn’t finish it because I got some errors, hope someone can start with this or I’ll try again another time.

1 Like