Asset - Project Glare Engine: Shader based illumination

Tizzio

Member
You sell it for 10$ each, and given the fact you have 49 reviews you'll have at least 200 sales... Okay :(
I understand your point. I worked on it for about 2 years, and i will continue to upgrade it when yoyogames will release a free version or "marketplace content creator license" (where you can use the engine without export modules). This marketplace for me is more like a collaboration with them, because i switched to another engine.
Anyway, GMS2 is currently in beta, so we can't say anything about the final price
 

DukeSoft

Member
True, true, very true.

I'm still a fond user of GM:S1.4 and I'm using your engine too.

While we're at it, i have a question;

I have multiple wall objects that each use a JSON vertex list. They are aligned next to each other, but it seems like they sometimes cast shadows on top of another (and sometimes not).

I also see that a light kind of layers over the wall, where I would actually like the light to just stop at the wall, and not light it at all. Is this the light / mesh height?

Do you understand what I mean?
 

Tizzio

Member
I have multiple wall objects that each use a JSON vertex list. They are aligned next to each other, but it seems like they sometimes cast shadows on top of another (and sometimes not).
Do your meshes have a depth?
I also see that a light kind of layers over the wall, where I would actually like the light to just stop at the wall, and not light it at all. Is this the light / mesh height?
Do you understand what I mean?
Each light does a check before rendering a visible mesh: if its layer is lower than the mesh's layer, no shadow will be cast
 
S

Spacedog

Guest
I have a tester who gets an error that I can't reproduce on a different machine, and I'm not sure where to start fixing it:

FATAL ERROR in Vertex Shader compilation
ShaderName: glr_shader_mesh_color

D3DXCompile failed - result

at gml_Script_glr_render

His machine is an AMD FX 8350 with an Nvidia GTX 1060 on Windows 10 64bit.

My machine is the same except I have a GTX 970, and I don't get this error.

Any ideas what the problem might be?

EDIT: Found the problem, lack of DirectX runtimes. This package fixes it https://www.microsoft.com/en-us/download/details.aspx?id=8109
 
Last edited by a moderator:

rIKmAN

Member
Would the lights in this asset work with sprites created with something like SpriteIlluminator that uses normal maps?

I saw an earlier comment on page 1 that said it didn't support bump maps, so thought I would ask about normal maps.
 
I

Ian

Guest
I understand your point. I worked on it for about 2 years, and i will continue to upgrade it when yoyogames will release a free version or "marketplace content creator license" (where you can use the engine without export modules). This marketplace for me is more like a collaboration with them, because i switched to another engine.
Anyway, GMS2 is currently in beta, so we can't say anything about the final price
Was wondering if you have any plans to make it compatible with GMS2.

I just got it, i imported my project and ran it. As for your lighting engine everything worked except shadows. Looked back in the compatibility log that was made when i imported my project i got errors on "layer" variable which i find out is used quite frequently in your enumerators and the reason for the error is because GMS2 now has "layer" as a built in function :/

Its used alotttttt and im not going to waste my time doing tedious fixes just to port a lighting engine (the reason i have it, to avoid the hassle. why reinvent the wheel) to GMS2 when i can keep working on GMS 1.4

So might get a refund on the engine and just keep working on 1.4

EDIT:

Heres a screen cap
 
Last edited by a moderator:
L

Lycanphoenix

Guest
The scripts are stored in GMX, if I recall correctly, which is based on XML. Using Notepad++ should let you do a mass edit by searching for all instances of something and automatically replacing it with something else.
 
I

Ian

Guest
The scripts are stored in GMX, if I recall correctly, which is based on XML. Using Notepad++ should let you do a mass edit by searching for all instances of something and automatically replacing it with something else.
Its not just that:

Where it clears all lights/shadows at room end. What would have changed from how it ran on 1.4 to 2?
 
L

Lycanphoenix

Guest
I'm afraid I don't know enough about GM:S 2.0, or about programming.
 

rIKmAN

Member
Would the lights in this asset work with sprites created with something like SpriteIlluminator that uses normal maps?

I saw an earlier comment on page 1 that said it didn't support bump maps, so thought I would ask about normal maps.
 
I

Ian

Guest
Would the lights in this asset work with sprites created with something like SpriteIlluminator that uses normal maps?

I saw an earlier comment on page 1 that said it didn't support bump maps, so thought I would ask about normal maps.
Well if u wanna debug, use the glare demo because it utilizes most to all features so if you can run all rooms smoothly with no errors u got it. Everything in the demo worked in GM:S 2 until u get to the second top down room. Then it gives u that error i posted.
 
M

MilkyBrain

Guest
Hello.

I've got a problem with static light and JSON mesh.


http://imgur.com/sAIKk29

When I use static JSON mesh and static light, there are unknown shadow rays right above the mesh. However, there is no problem with dynamic lights.
How can I prevent it?

P.S. JSON mesh has about 100 points.


http://imgur.com/7WY1tXq

Thank you.
 
J

joakimFF

Guest
Has anyone got the new rendering mode working under anything else then windows? I tried on ios,android,macos and linux and the result is the same. The entire view is just white and you can see the light sources as bloomed splotches.
 

DukeSoft

Member
Its not working on other platforms? ... I've only developed on WIndows and was assuming this asset was of decent quality :p
 

DukeSoft

Member
Hello.

I've got a problem with static light and JSON mesh.


http://imgur.com/sAIKk29

When I use static JSON mesh and static light, there are unknown shadow rays right above the mesh. However, there is no problem with dynamic lights.
How can I prevent it?

P.S. JSON mesh has about 100 points.


http://imgur.com/7WY1tXq

Thank you.
I managed to fix it! Looks like my points were inversed. You'll need to go clockwise with the points (I think). Try loading in the mesh in the editor; https://tizzio.github.io/meshgen/ and reversing the order. This fixed my issues!
 
S

sheffrator

Guest
Hi.
How can I keep my background light and not affected by darkness? Like you have in demo scene room_glr_platform_outside with night sky and stars.
Thank you.
 

kburkhart84

Firehammer Games
I came here wanting to ask when the engine would be updated to GMS2....good thing I haven't bought it. The last post from the author here was Jan 29th. I read thru the topic as well and saw that the author had moved to another engine, meaning he/she didn't want to invest in GMS2 in order to make this happen. I also happened on the author's website, and the link for the support forum was never updated(still points to the old GMC). So, I'm feeling like it isn't a good idea to invest in this asset currently, as I don't think it will be getting updated or supported anymore....sucks to see that happen to good assets.
 

DukeSoft

Member
I came here wanting to ask when the engine would be updated to GMS2....good thing I haven't bought it. The last post from the author here was Jan 29th. I read thru the topic as well and saw that the author had moved to another engine, meaning he/she didn't want to invest in GMS2 in order to make this happen. I also happened on the author's website, and the link for the support forum was never updated(still points to the old GMC). So, I'm feeling like it isn't a good idea to invest in this asset currently, as I don't think it will be getting updated or supported anymore....sucks to see that happen to good assets.
As far as I can tell most of it was from the CNBA engine anyway, but yeah this is more performant as it uses the GPU. Maybe try moving that project to GM:S2?
 

kburkhart84

Firehammer Games
I'm understanding it had features of the CNBA engine, but I doubt Tizzio actually used any of the code from that. That project is pretty old to be much use in newer GMS from how I see it, and this engine was using shaders, not surfaces.
 

DukeSoft

Member
I'm understanding it had features of the CNBA engine, but I doubt Tizzio actually used any of the code from that. That project is pretty old to be much use in newer GMS from how I see it, and this engine was using shaders, not surfaces.
This uses both shaders and surfaces, and it does look a lot alike.. So hence my assumption
 

kburkhart84

Firehammer Games
Yeah, I get the look-alike part...they look close enough and have close enough of a feature list...it happens. But seeing the internals of the two you can tell that Glare did not directly copy CNBA. Also, as far as lighting engines go, you generally have one big list of features, many of which are going to be in all lighting engines, and then others that are only going to be in the 'powerhouse' engines. CNBA and Glare I would consider to be 'powerhouse' engines and therefore would contain many of the same features.
 
R

Rednavi

Guest
Man, it's a shame that this doesn't work in GMS2 correctly. I would've bought it in a heartbeat otherwise.
 

AllCrimes

Member
It's very strange.

I am running GMS2. I have two projects with version 2.4.1 of glare installed. The older project from around the time of release works, but the newest project with files added from the current marketplace within GMS2 does not work.

Not sure why they would be different since they both share the same version, but I'm going to try importing the files from my old project instead of from the marketplace sometime this weekend to see if that fixes things...
 
B

Bruno A.

Guest
Hello, need help with a problem about the rendering modes.

Currently, I'm using the common render "glr_draw" mode, which works just fine.
normal render.jpg

But I really wanted to switch to the new rendering system "glr_draw_gamma". The problem is that when I do this, everything gets's stretched.
new render.jpg

I presume this happens because the right menu bar which has its separate view, is also rendered onto the application_surface and because the new rendering system handles surfaces instead of views, the lightings get stretched as if the entire thing is the world.

Any help? Thank you.
 
Last edited by a moderator:

DukeSoft

Member
I have it working in GMS2. It takes some fiddling with the view settings but thats about it.

@Bruno - try changing some resolution settings within Glare. Its using a funky setup with views and surfaces.
 
B

Bruno A.

Guest
I have it working in GMS2. It takes some fiddling with the view settings but thats about it.

@Bruno - try changing some resolution settings within Glare. Its using a funky setup with views and surfaces.
Thanks!

After 2 minutes of examining the "glr_draw_gamma" script, I found the solution. How didn't I think of that before?

For anyone with a similar problem, keep "argument0" as "application_surface" but in the script, change lines 41 and 42 to the desired width and height.
 
7

7bones

Guest
Hello! I bought Glare engine and I think is really great tool! But I have one big problem with it i cant solve.
Im making top-down game where camera is rotating with view of obj_Player,also using often zooming of screen.When i rotate screen i see end of surface,like player is always in corner of surface where glare is working- no matter how big surface i make (even much bigger then room)-player will be always in corner-and when rotate or zoom out it is visible.Here is question: how make surface ALWAYS draw center to the player position?

Here is example in movie


Edit.Solved if enyone have same problem
I added in glare_controller in draw
var v_x0 = view_xview[0]-600,
v_y0 = view_yview[0]-720,

Now i have antoher one: how make torchlight?? I mean how dynamic change color in lights?
 
Last edited by a moderator:
B

Bruno A.

Guest
Now i have antoher one: how make torchlight?? I mean how dynamic change color in lights?
If I understand correctly, you want a torch that alternates between different shades of orange and yellow.

I can show you a torch object from my project, it's not perfect but it works decently and it's easy to improve from there.

Obj_torch
Create Event:

Code:
lum = 0.1;
alarm[0] = 2;

sprite = spr_glr_light_mask_point_768; // Use any gradient of your choice here
color = make_colour_hsv(13, 180, 180); // i used just one color but you can add more
light = glr_light_create(sprite, 0, x, y, color, lum);
glr_light_set_layer(light, 10);
glr_light_set_depth(light, 5);
glr_light_set_shadow_strength(light, 0.4);
Alarm[0]:
Code:
var ri = random_range(lum/2, lum*1.25);
glr_light_set_intensity(light,ri);

alarm[0] = room_speed/5;
This creates a light and will randomly change its intensity pretty rapidly, simulating a real torch effect.
If you want to add color variation, you can just create more colors in the create event and use a choose function in the alarm[0] to randomly alternate between all the colors. For example:

Alarm[0]:
Code:
glr_light_set_color(light, choose(color, color2, color3));
Honestly, I didn't think color variation was necessary but if you take your time finding the right colors, it may look better.

Hope this helps.
 
Last edited by a moderator:
B

Bruno A.

Guest
One question:

Is it possible to change the direction of "directional lighting" shadows? I want them to point north at noon and move from right to left.

I tried searching the core files and I found something promising but unfortunately, nothing happens when I change it. Maybe some other variable is overriding this one?

glr_init:
120: global.GLR_DIRECTIONAL_STRENGTH = 0.5;
121: global.GLR_DIRECTIONAL_ANGLE = 320;
122: global.GLR_DIRECTIONAL_LENGTH = 0.2;
 
Last edited by a moderator:
B

Bruno A.

Guest
Ok, I found it...
It's in the script "glr_set_ambient_daytime" at line 69.

Changed the default math to the one below and now the shadow faces north and moves from west to east, like in the northern hemisphere.
Code:
global.GLR_DIRECTIONAL_ANGLE = 180 - (a * 150);


EDIT:

Code:
global.GLR_DIRECTIONAL_ANGLE = -100 - (275 * a);
Or this one to keep the rotation flow exactly the same as the original but following the above specifications.
 
Last edited by a moderator:
7

7bones

Guest
thx
But i have new one now
My light shows on view to late,im already in distance to see it but it still off-then it rapidly turns on like switch- but that is fire flame so looks very bad.How make light turn from farer distance??
 
S

Spacedog

Guest
Has anyone managed to figure out why the new rendering system doesn't work in GMS2 yet?

It looks like something that could be quite simple, like the lights are simply overwriting the application surface instead of blending but I don't have the skills to figure it out.
 
I

Ian

Guest
I have a weird glitch, when theres no light source inside the view the glr surface gets dis-positioned (when theres light everything goes to where it should):


anybody else experience this before?


EDIT:
Not really a fix but just went ahead and enabled directional lighting and any shadow mesh in the game i just added
Code:
glr_mesh_set_directional_shadow_length(mesh, 0);
 
Last edited by a moderator:
I

Ian

Guest
Would anyone know how to get lights/shadows to only show for foreground elements (excluding the BGs) on a 2D Platformer?
 

Ednei

Member
I converted my project from GM1.4 to the GM2 and the Glare Engine worked very well.

However I tried to create a Minimap using view_camera [1] and realized that Glare Engine is interfering with the correct functioning of this camera:
Pic1 (glare off)
glareoff.png

Pic 2 (glare on)
glareon.png

I'm trying to create a Minimap that shows a complete aerial photo of the Room as in Pic1 (glare off), however with the Glare on the Minimap does not work correctly Pic 2 (glare on).

To create this Minimap I used this code:

Code:
view_visible[1] = true;     
view_xport[1] = 0;
view_yport[1] = 0;
view_wport[1] = 256
view_hport[1] = 176

view_camera[1] = camera_create_view(0, 0, room_width, room_height, 0, noone, 5, 5, -1, -1);
I know this topic does not support GM2, but someone had this experience and can you tell me what's going on?

Thank you

Ednei
 
I

Ian

Guest
nvm, you cant give the light a depth feel with the glare engine like this:
 
I

Ian

Guest
Has anyone found out how to fix the 'glr_shadowarea_destroy_all' script in GM:S 2?

Is it the new d3d_model_clear compatibility script causing the problem?
 
A

Andysaur

Guest
Hello guys, this is my first post ever!

I recently purchased the glare engine, such a great tool, and I've been trying to apply it, a little unorthodoxly, for a top down pixel art game similar to The Legend of Zelda: A Link to the Past. I am using Game Maker Studio 1.4. I have a couple of questions:

1) I want my hero and enemy objects etc. to NOT be shadowed by the global.GLR_MAIN_SURFACE because their sprite should change color ( lit / shadowed) according to their x,y origin position on the room, otherwise the shadows don't fall quite right on top of them and don't match the perspective. BUT I still want all the background tiles, ground and walls to be lit by the global.GLR_MAIN_SURFACE.

My solution was to change the depth of the obj_glare_controller to -1 so that the objects in the room are not affected and only the background tiles are. And then use this code in the draw event of the hero object for example:​

hero object's Draw Event:

draw_self()
if (surface_exists(global.GLR_MAIN_SURFACE))
{
draw_set_blend-mode(bm_add);
col = surface_getpixel(global.GLR_MAIN_SURFACE, x, y);
draw_self();
image_blend = col;
draw_set_blend_mode(bm_normal);​
}

The result is the hero becomes completely black in shadowed areas disregarding the gradient of the shadow and around light areas his color is not consistent to the gradient of the light but flashes in a seemingly random manner. Sorry, that's the best discription I could write.

Is there a way to achieve this? ALSO I read it's not the best practise to use the surface_getpixel command because it is costly in memory. Is there a better way to do this?​

2) Can I group a few shadow objects together so that their shadows don't add on top of eachother? I don't want their shadows to darken as they fall on top of eachother. I want them to stay the same shade of grey :p and I also want them to have the same shadow strength.

Please help me, I am getting a real headache over all this depth and tile layer situation! Sorry for my english, I'm Greek. XD :p
 

Tizzio

Member
I Finally got some time and updated Glare to GMS 2.3
I barely use the forum, so hit me on Discord if you need help or have suggestions!

Changelog (since 2.4.1)

v2.7.3
  • Porting to GMS2.3
  • Removed compatibility scripts
  • Improved performance replacing all d3d_transform_* calls with proper matrix functions
  • Rotated light sprites to be consistent
  • Added glr_shadowarea_set_transform
  • Fixed glr_draw_gamma (now you can use additive rendering)
  • Fixed shadowdepth (workaround for this report)
  • Fixed shadowsprites deactivation
  • Fixed glr_shadowsprite_destroy
  • Fxed d3d_model_destroy conversion crash
  • Fixed glr_simplelight_destroy
  • Fixed shadowareas for gamma rendering mode

You can find the update inside the IDE
Marketplace > My Library
 

Ednei

Member
I Finally got some time and updated Glare to GMS 2.3
I barely use the forum, so hit me on Discord if you need help or have suggestions!

Changelog (since 2.4.1)

v2.7.3
  • Porting to GMS2.3
  • Removed compatibility scripts
  • Improved performance replacing all d3d_transform_* calls with proper matrix functions
  • Rotated light sprites to be consistent
  • Added glr_shadowarea_set_transform
  • Fixed glr_draw_gamma (now you can use additive rendering)
  • Fixed shadowdepth (workaround for this report)
  • Fixed shadowsprites deactivation
  • Fixed glr_shadowsprite_destroy
  • Fxed d3d_model_destroy conversion crash
  • Fixed glr_simplelight_destroy
  • Fixed shadowareas for gamma rendering mode

You can find the update inside the IDE
Marketplace > My Library
This is the most anticipated extension update ever.
I consider the Glare Engine the best and most important extension made for GM.
Thank you very much Tizzio!
 

Vector

Member
Hello, Tizzio ! I have started learning how to use Glare yesterday following your tutorial on Altervista step by step and I got some big noob issues with it. And don’t get me wrong, Glare is amazing. I think it's all my lack of experience.
BTW, I use the last GMS2 version: IDE v2.3.3.574 Runtime v2.3.3.437

I have two problems for now.

1) If I use new rendering system in the post-draw, my lights immediately go crazy like this:
00.PNG
If I use normal draw it’s fine, but I’d like to try the additive rendering. I don’t understand what’s wrong in my code. I copy-pasted the code from your tutorial so it should work, right?

2) While I’ve managed to get a shadow from sprite, it didn’t work for a mesh. Look at this screenshot:
01.PNG
The crate on the right is casting a shadow but not the crate on the left. The creation code for the left crate is:
GML:
wallMesh = glr_mesh_create(x, y, false);
glr_mesh_submesh_add_json(wallMesh,"[[0,0],[0,16],[16,16],[16,0]]",0,0);
glr_mesh_update(wallMesh);
The sprite is anchored on top left so it can’t be a mesh problem…
So, I’ve tried to figure out what’s wrong with my code… or with myself. And now I will show some magic! Let’s pick up a toilet (obj_glr_toilet) from the Demo folder and put it right in the middle of the room:
02.PNG
Honestly, I never thought a toilet could be that powerful :D Not only it casts a shadow with it’s mesh, but it also solved the problem of the left crate! But… why?
At the same time, I feel completely lost. I am new to the lighting systems in general and I have a feeling that the tutorial is far from being complete… Can you help me with those issues and with general Glare setup?

Bonus: Bug report! When I have imported Glare and before I put anything in the room I’ve run the game and had this compile error.

Script: glr_get_illumination_update at line 17 : wrong number of arguments for function buffer_get_surface
Solved it by disabling a bit of that function like this:

GML:
buffer_get_surface(global.GLR_ILLUM_BUFFER, global.GLR_MAIN_SURFACE, 0/*, 0, 0*/);
After my tests with crates if I enable this peace of code the compile error returns too.
 

Teemon

Member
What about mobile performance? Who may advice good engine with enough performance for mobiles and which has rich features?
 
Top