• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Is the lighting implemented yet in BETA?

Double7

Member
I am planning on using GMS2 for a future project and I am trying to get some lighting working. I am copy pasting what it has in the manual just to try to get it working and nothing is happening in my game.

Here is my code

Code:
draw_self();
draw_set_lighting(true);
draw_light_define_direction(1, 0, 1, 0, c_white);
draw_light_enable(1, true);
This is taken directly from the draw_set_lighting() manual page and I have tried both with and without the "draw_self()". Has anyone successfully been able to get this system working?
 
Last edited:

mMcFab

Member
Technically, the lighting is already implemented (in the same way as 1.X), but it isn't this straightforward to use.
As far as I'm aware, the only lighting model currently implemented by default is Gouraud shading (when using the default shader and normals on your vertices - I don't believe it actually does anything to standard sprites except make them appear the same color as whatever "draw_light_define_ambient(col)" is set to, as they don't have normals - it's only really useful when using 3D.
Alternate shading techniques and shadow casting need to be implemented by us (I assume that's kinda what you're after). If you want shading, you going to need a shader (which we either need to write ourselves or see if there's one we like on the marketplace or somewhere). Shadow casting varies a little more, depending on what we want, but I think there's a lot of downloadable projects from 1.X that may still work (I usually use surfaces and sprite combos, which should be compatible with GMS2).

To summarise, basic lighting is implemented, but it is by no means automatic - the code you have posted from the manual won't really do much unless you either use shaders and/or vertex_buffers with normals defined. Shadow casting is also not something automatic and we need to build that ourselves too (which makes sense since there's so many ways of doing it)

I hope this can help in some way! If you can provide some kind of idea of what you want as well - like a mockup and a description of the effect you want to achieve - it's very possible we can help you out further!
 
Top