Shaders Built-in lighting functions


Hi all.

The manual has a chapter on lighting.
It has a couple of functions like draw_light_define_ambient, draw_light_define_point, draw_light_define_direction, ...

I can access gm_LightingEnabled, MAX_VS_LIGHTS, gm_LightingEnabled and a couple of other variables in the shader. But there doesn't seem to be a way to get the actual lights' data.

Is there a way to access these lights that I define or is it better to just send in the light data using custom uniforms?


ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
if you make a shader with some distinctively-named variable, compile the game, and then open your with a hex editor, you can use search to locate your shader in the binary, and then scroll back to see the rest of the built-in shader "stub" with its various variables


Hm yes, I see it now.

I had a look at the content of and found quite a few variable names there: gm_Lights_Colour, gm_Lights_Direction, gm_AmbientColour, ...
So the names are there, but there seems to be no way to actually use them in a shader.
And it doesn't seem to work with the default shader either.

Then I guess I'll have to define my own uniforms for the lighting.

Thanks for the hint!