Shaders Built-in lighting functions

Discussion in 'Programming' started by Bart, Sep 11, 2019.

  1. Bart

    Bart Member

    Joined:
    Jun 21, 2016
    Posts:
    165
    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?
     
  2. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,382
    if you make a shader with some distinctively-named variable, compile the game, and then open your data.win 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
     
    Bart likes this.
  3. Bart

    Bart Member

    Joined:
    Jun 21, 2016
    Posts:
    165
    Hm yes, I see it now.

    I had a look at the content of data.win 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!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice