borup3 / lighting-system-2d Goto Github PK
View Code? Open in Web Editor NEW2D lighting system for GameMaker Studio
License: MIT License
2D lighting system for GameMaker Studio
License: MIT License
Hi, I followed the tutorial step by step and I'm getting
_________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_light_renderer:
trying to index a variable which is not an array
at gml_Script_lighting_pre_composite (line 21) - outside_active_camera = !rectangle_in_rectangle(cached_polygon_area[0], cached_polygon_area[1], cached_polygon_area[2], cached_polygon_area[3],
############################################################################################
gml_Script_lighting_pre_composite (line 21)
gml_Script_composite_shadow_map (line 10) - lighting_pre_composite();
gml_Object_obj_light_renderer_Draw_0 (line 8) - exists = composite_shadow_map(global.worldLights);
If I create blank project and create the demo project I get
___________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_light_renderer:
trying to index a variable which is not an array
at gml_Script_light_trace_polygon (line 44) - var vertex_count = polygon[ePolygon.Length];
############################################################################################
gml_Script_light_trace_polygon (line 44)
gml_Script_light_update (line 208) - shadow = light_trace_polygon(id, light);
gml_Script_light_draw_shadow_map (line 40) - var vertexbuffer = update ? light_update(light) : light[| eLight.VertexBuffer];
gml_Script_composite_shadow_map (line 122) - light_draw_shadow_map(light, shadowMap, true);
gml_Object_obj_light_renderer_Draw_0 (line 8) - exists = composite_shadow_map(global.worldLights);
Please help me make this work, I don't understand what am I doing wrong.
FATAL ERROR in
action number 1
of Draw Event
for object obj_light_renderer:
stack frame is
gml_Script_shadow_map_ensure_exists (line 24)
called from - gml_Script_composite_shadow_map (line 24) - var has_shadow_map = shadow_map_ensure_exists(eShadowMap.Global);
called from - gml_Object_obj_light_renderer_Draw_0 (line 8) - exists = composite_shadow_map(global.worldLights);
I have several lights in a scene. Whenever I change rooms, the following error is thrown.
ds_list_find_value argument 1 incorrect type (array) expecting a Number (YYGI32)
at gml_Script_light_destroy (line 8) - var buffer = light[| eLight.VertexBuffer];
############################################################################################
gml_Script_light_destroy (line 8)
gml_Object_i_Light_CleanUp_0 (line 4) - light_destroy(light);
When I inspect eLight.VertexBuffer in the debugger, the value shows as 14, not an array as the exception states.
Im using this but the game is lagging, if there is too much lights I'm modyfying the global_lightning function but its not enought, I guess the shader is very recursfull
Whenever I child an object to the light emitter, it doesn't render any light and gives cleanup errors. I've looked at the example rooms and still can't figure anything out.
Hello, first off thanks a lot for sharing this great engine. It works great on windows but in HTML5 the lights don't seem to work, the shadowmap is present but lights don't appear. Since there is no error i have no idea how to fix this. (using runtime 2.2.1.291)
Thanks in advance
I've tried changing the Light_color variable before (doesn't light at all) and after (doesn't change color) the event_inherit() function, but I can't figure it out.
Hey, I downloaded and tried this lighting system yesterday, it's really fantastic work! Thank you so much for open-sourcing it!
I did have a quick question though as I've only started using GMS2 a few days ago so I'm not mega-familiar with it yet... (although I have written an entire game engine myself (see https://github.com/irrelon/ige) so I'm not a noob either).
Does the lighting system support multiple viewports? I tested with a multi-viewport game but I am seeing a weird effect where the second viewport's shadows follow the position of the first viewport's camera.
I had a look in the lighting system source code and it looks like it should work because it's getting the active camera at time of render but I'm obviously missing something!
On the left viewport (the first vp and camera) the shadows look fine. On the second on the right, they are offset by the position of the left viewport's camera.
Here's a pic of what I mean:
So i wasnt sure where to post this but. How do i make it so the point light can't be covered.
Backwards blending on the directional lights sometimes leaves what appears to be less bright versions of the main light. This undesirable effect is most noticeable on low resolution games with moving and rotating lights.
The bottom picture shows the temporary fix of setting the BLEND_TEXELS distance to 8.0 instead of 64.0. However this has diminishing effects on the blending quality.
The shadows don't render correctly on MacOS resulting in either a flickering between no shadows or 100% shadows across the whole viewport. The issue has been occuring on a 2022 M1 Pro Macbook Pro with MacOS Ventura. Please let me know if someone else manages to re-produce the issue on their machine!
As it can be seen on the screenshoot, in a case the instance we want to create polygons from has an angle different than 0 degrees, the polygons will be created taking into account the sprite width, instead the bounding box, which is a different behavious from the case of 0 degrees.
This should be fixed and also there could be an additional boolean argument in the function to alternate the polygon generation: either using the bounding box or the sprite dimensions (by deault true which means generate from bounding box).
Would be cool to see this working in HTML5 (assuming its not already). I have tried with no luck, however it works fine in Windows.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.