GameMaker (2.3)

Luminous Chickens

Tiberia Prima

You must be logged in to obtain assets


There are three basic 3D light types: directional lights, point lights, and spot lights. These can be implemented using shaders. Here's a set of shaders (and a demo project) to do just that!

Because fog is also something one often wishes to make use of in addition to lighting, this also includes fog.

The asset package is for GameMaker Studio 2.3. I'm going to assume this is fine with everyone since 2.3 is now officially released.

  • Directional lights - defined by an XYZ direction vector and a light color.
  • Point lights - defined by an XYZ position, a light color, and a range. Optionally you may specify an inner range where the light will start to fade.
  • Spot lights - defined by an XYZ position, an XYZ direction vector, a light color, and a cutoff angle. Optionally you may specify an inner cutoff angle where the light will start to fade.
  • The option to calculate the lighting in the fragment shader (looks better - this is what one usually wants) or the vertex shader (marginally faster - looks terrible with large triangles, particularly with spot lights).
  • Pixel fog - defined by a color, a start distance, and an end distance. Optionally you may specify a strength modifier that will affect the amount that fog at the maximum distance will be blended to the color.

The shaders expect a 36-byte vertex format defined with a 3D position, a 3D normal, a 2D texture coordinate, and a 4D color. If your game builds vertex buffers with a different format, you will need to edit the attribute list in each shader. I won't do this for you; that's on you. Generally speaking, position/normal/texture/color is sufficient for just about everything and you're probably already using this anyway.

I've got a 3D GameMaker tutorial series going, which includes writing lighting shaders. Even if you use this asset, I strongly recommend having a rough idea of how the shaders work because it will make your life much easier in the future.

For the most part, basic lighting shaders do exactly one thing and you won't ever need to edit them - but in the case of point and spot lights, you may sometimes wish to edit the attenuation values to change the way light fades out. Those calculations can be found on the lines that contain float att = ... in each of the relevant shaders.

Don't do this unless you're experienced with shaders. As usual, I recommend Desmos or another graphing calculator to model falloff equations.

The asset is free as-is. I'll fix simple or game-breaking bugs but more involved support requires payment via either Itch (above) or Patreon. With that said, I don't imagine much about this asset will change going forward.

The icon is based off of my late chicken. Appropriately, we named her "Noches" many years before I decided to name a lighting shaders after her. RIP Noches :(

  • The chicken icon and duckling sprite were created by @alemunin
  • The 3D meshes in the demo were created by
  • The skybox in the demo was created by Spiney
  • Xpanda is a tool for using shader includes in GameMaker by @kraifpatrik​​

End User Licence Agreement (EULA).

Age Rating: 4+


GMS2.3 - Version 1.3.0. Published September 29, 2020

initial asset

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait