YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
21 stars 8 forks source link

Shaders: light-related built-in uniforms don't work correctly in custom shaders #6509

Open Indibulous opened 2 months ago

Indibulous commented 2 months ago

Description

as mentioned in https://github.com/YoYoGames/GameMaker-Bugs/issues/6425 a number of uniforms listed on the Shader Constants manual page currently don't appear to work when accessed inside a custom shader. The gm_Lights_Direction, gm_Lights_PosRange, gm_Lights_Colour, and gm_AmbientColour uniforms, aside from having incorrect syntax highlighting as indicated in that issue, also seem to have some incorrect functionality:

Here's an in-development version of the xUnit test framework which includes tests for these uniforms in the BasicShaderTestSuite: xUnit Shader Tests.zip

Expected Change

Steps To Reproduce

  1. Start GameMaker
  2. Run the included version of xUnit: xUnit Shader Tests.zip
  3. Check the Output after running to see the tests for gm_lights_direction, gm_pos_range, and gm_lights_colour failing
  4. Open Users(user)\AppData\Local\GameMakerStudio2\GMS2TEMP\xUnit_(numbers)\ShaderTests for the visual test outputs
  5. Open the LightsDirection, LightsPosRange and LightsColour folders in that directory and observe the difference between the expected and resultant values for the tests to see the issues. (note that there is an additional bug causing LightsDirection to fail, mentioned in #6507, causing the direction of the light to be inverted)

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

2024.6.0 (Monthly), 2024.600 (Betas)

Which platform(s) are you seeing the problem on?

Windows

Contact Us Package Attached?

Sample Project Added?

Indibulous commented 1 month ago

Just thought i should add, I initially only tested this in the GLSL/GLSLES shader language, which produces the behaviour described, but after testing in HLSL, found that the mentioned uniforms will just throw an error upon using shader_set() with the shader containing them:

image

I have created a new issue for this: https://github.com/YoYoGames/GameMaker-Bugs/issues/6840