A downloadable asset pack for Windows

Buy Now$59.00 USD or more

Documentation  | Forum Thread  |   DEMO is now available below!

πŸ‘€ Are you frustrated by the lack of a feature you want so much?

βœ… Crystal offers the most complete and efficient lighting & shadows solution for any kind of 2D game. Everything you see in other lighting systems, you can do with Crystal.

πŸ”₯ The ultimate 2D lighting & shadows with Disney's PBR support solution for GameMaker. All this in a package of less than 500 kbytes of code!

"But I just just need a simple lighting system!" no problem, by default Crystal starts with the basics. πŸ˜‰

FEATURES:

  • Flexible systems allows you to use from basic to advanced without compromising performance;
  • Easy to use and fully customizable, you have control of literally everything, every visual aspect (artist-friendly);
    • MVP easily achievable;
  • Free updates and individual customer support;
  • You don't need to know how it works internally, everything you need is exposed;
  • Ideal for both 2D pixel-art and HD/high resolution games. Platformer, Top-Down, RPG, Isometric, etc.
  • Deferred+ (plus) Rendering;
    • Evolution of classic deferred rendering;
    • Render unlimited number of lights, shadows and materials;
      • Your hardware is the limit.
    • Between 5.000 - 10.000 lights at the same time without slow down!*
    • Unlike other lighting systems that use multiple surfaces for a few lights.
  • Take control of the final rendering and use your own shaders to apply the effects you want! (Very Easy)
  • Fast performance;
    • Culling is used to render and calculate only on-screen lights, shadow casters and materials;
    • Disable lights, shadows and materials outside of camera view (optional);
    • Easily disable features you don't want;
    • VRAM friendly too;
    • Very fast shader compilation;
    • Very efficient shaders;
    • Render resolution adjustable;
      • Also adjust the individual resolution of each pass easily: Lights, Normals, Emissive, Reflections, Materials, etc.
  • HDR (High Dynamic Range)!
    • Use this to have extremely beautiful and contrasting lights!
    • Bloom light support;
      • The bloom shader is not included. I used Post-Processing FX to demonstrate emissive materials working.
    • Optional;
  • Lights collision!
    • Inspired by Rayman Legends and Among US, you can detect collision (get pixel color & intensity) with lights to create interesting mechanics.
  • Rotated Cameras!
    • Supports rotation, zoom, 2D cameras + orthographic 2D cameras (matrix);
  • Light penetration (edge lighting);
    • Useful for Terraria style lighting;
  • Fast GPU vertex shadows;
    • Soft + hard shadows (customizable smoothness);
    • Animated shadow casters;
    • Shadow depth adjustable (per-occluder + per-light);
    • Shadow length adjustable (per-occluder + per-light);
    • Shadow penumbra adjustable (per-light);
    • Shadow umbra adjustable (per-light);
    • Dynamic shadows (moving objects);
    • Static shadows (e.g. scenario);
      • Prevents freezing when adding or removing multiple static shadows;
    • Transformed and non-transformed shadow casters (for optimization);
    • Functions to create circular, rectangular, from bounding boxes, path and others shadow casters;
    • Create shadow casters using objects and code;
    • Activate and deactivate shadow casters without having to destroy them;
    • Self-shadows support;
  • Sprite shadows;
    • Normal mode + with perspective;
    • Offset + angle + alpha + depth;
    • Vertex buffer mode allows you to render multiple shadows in a single batch;
    • Blur support;
    • Render resolution support;
    • Dynamic + static;
    • Animation support;
  • Depth is supported for everything, including lights, shadows, materials etc. It is possible to place everything on specific layers and depth!
  • Powerful Debug UI:
    • As a bonus, there is a compact UI script where you can edit and test stuff in-game!
  • Lights are objects with Variable Definitions - useful for modularization in the room editor;
  • 8 Light Possibilities (ultra customizable):
    • Point;
      •  With natural/cozy look;
    • Spot;
      • Ultra customizable cone light;
      • Width, corner and tilt support;
      • 3D cookie projection sprite support (gobo);
    • Sprite:
      • Use any sprite as light, with animation support. Useful for light projected from a window or trees, for example.
      • Supports normal maps and BRDF too.
    • Directional (Sun):
      • Supports rotation, shadows, infinite lights and more;
    • Shape (Free Form):
      • Define points using paths! Visually edit the shape of the light in the room editor;
      • Inner and outer colors;
      • Self-adjusting corners with precision amount;
      • Supports shadows too;
    • Basic light:
      • Ultra efficient sprite light;
      • Allows you to draw whatever you want in the Draw event;
    • Line;
    • Ambient;
      • Color overlay support, with intensity;
      • Also allows you to use customized hue/saturation/brightness using a single sprite!
  • Define per-light shader complexity (for performance control);
    • Basic;
    • Blinn-Phong;
    • BRDF (PBR);
      • Uses Disney's GGX implementation;
  • Light Blend Modes:
    • Multiply;
    • Multiply Normalized;
    • Multiply Linear;
    • Add;
  • Materials (optional) - with animation support + fast realtime GPU baking + multiple per-instance materials:
    • Albedo;
    • Normal Map (supports rotation and scaling);
    • Metallic;
    • Roughness;
    • Ambient Occlusion;
    • Emissive (with natural blending!);
    • Unlit (with black color + alpha support - useful for UI)
    • Reflections: useful for crystals, water, floor, etc;
      • + SSR (Screen-space reflections) - optional;
        • Sets a sprite as the sky too - animation support.
      • Back sprite rendering support;
  • Layer Materials:
    • Support for all materials listed above ^;
    • Render a layer as if it were a light, emission, and others;
    • Renderize a range of layers into a single surface too;
    • Tilesets support or any layer type: place normal map sprites, materials and other stuff easily;
    • Particles support: drag and drop a particle system into the room and it will emit bloom. It works via code too! :D
  • Layer effects (customizable):
    • Automatic normal map generator for layers;
    • Outline/edge normal map generator;
    • Create your own layer effects;
  • Spine support;
    • Materials, including normal maps, also work;
    • Also works with delta time, rotation, scale, etc;
  • Box2D (built-in GM physics) support;
  • Works with online games;
  • Efficient: no surface will be created, until you use something (example: there will be nothing related to normal map in memory/VRAM, if you don't use it);
    • Automatically deletes surfaces from the renderer when not in use;
    • This is true for everything, including materials, lights, emission, etc;
    • No memory leaks;
  • Emissive particles via custom pass (beyond the layers);
  • No need to "Separate Texture Page" from anything;
    • Optimizing texture swaps and batch breaks.
  • Direct access to all render passes;
    • Get the lighting surface and others, for special effects.
    • Draw your own custom things in each pass easily.
      • With support for your custom shaders, blend modes and so on.
      • Just call crystal_submit().
  • Dithering (for retro aesthetic);
    • Optional - you can even disable it at compile time;
  • Define how the light and shadow will be lit on the layer;
    • Allowing lights and shadows not to reach the sky, for example and more advanced effects.
  • Day and Night cycle easy-to-use with LUTs;
    • Both manual (your own time) and automatic (you can control everything);
      • It is possible to set the clock speed, being able to have 24-minute days, for example.
    • Set the time using 24h-like values and it will be reflected smoothly!
    • Customize literally any hue/saturation/contrast as efficiently and quickly as possible;
    • Use curves to define when the lights should turn off/on!
      • This feature also allows you to extrapolate the intensity of the lights, as well as the intensity of the ambient light.
    • Supports Strip, Grid and Hald LUTs!
    • Delta time support (optional);
  • Support lights on during the day (no need to darken the image to see them);
  • UI pass: Support for emissive materials for User Interface;
  • Light Cookie Generator;
    • Allows you to create light masks from images, super customizable;
    • .IES (Illuminating Engineering Society) files support!
      • Industry standard lighting format IESNA LM-63 (2019, 2002 and 1995).
      • Exclusive feature!
  • Tools (optional):
    • Batch Normal Map Inverter (Y-flip);
    • Batch Alpha Baker: bake the albedo alpha channel (or a black & white mask) into other materials, such as normal maps and PBR;
  • Modular: It was developed for the end user in an intuitive way;
  • Function to calculate VRAM usage;
  • Purposeful compatibility with Post-Processing FX (works independently)
    • Also works with other libraries like Scribble, Input and so on;
    • Compatible with my other libraries;
  • Easy migration from other lighting systems;
  • Cross-platform;
    • HTML5 is not supported. Use WASM instead;
    • Frequently tested on Windows, mobile devices (Android), and GX.Games/Opera GX.
    • GLSL ES shaders;
  • Super well written and well documented code;
  • Documentation available + Discord server for help;

* Using Basic Lights. Note that using lights with shadows will have an added cost regardless, this is expected. Performance also depends on other factors such as hardware.

Some screenshots (from some games) on this page are illustrative and do not demonstrate sprites included in the project. They are used only as demonstration and the copyright belongs to their respective owners.

By purchasing, you agree that you may not resell or redistribute the source code in any way (ex: GitHub and Marketplace). The compiled product can be used commercially in any game or software. Use for any A.I. training is NOT allowed. This project was made entirely by a human.

What are you waiting for? You have the complete lighting solution in front of you! :D

Updated 18 days ago
StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(16 total ratings)
AuthorFoxy Of Jungle
GenrePlatformer, Role Playing
Tags2D, dithering, Effects, GameMaker, lighting, Pixel Art, Retro, Top-Down

Purchase

Buy Now$59.00 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $59 USD. You will get access to the following files:

CrystalLightingEngine_v2.1.yymps 327 kB
CrystalLightingEngine_v2.1_Example.yyz 41 MB
Light Cookies Pack.zip 573 kB

Download demo

Download
CrystalLightingEngine_v2.0_Demo.zip 23 MB
Download
License.txt 11 kB

Development log

Comments

Log in with itch.io to leave a comment.

Viewing most recent comments 1 to 40 of 48 Β· Next page Β· Last page

tbh im confused , i followed the guide but nothing happens, i checked the template however it has much more code compared to the guide so im just lost, i cant even get a basic light set up 

(+1)

Hello theyakuzi!

Sorry to hear, which part exactly confused you? Did you follow this guide specifically? Could you tell me what have you tried to do so far so I can give you some direction?

The .yyz project actually has more code because I needed to demonstrate how Crystal works in different situations. I know it might seem intimidating at first, but the process is simple. Sometimes it can be something silly that caused something not to work. I also have a Discord server for a more extensive discussion.

i got it! it seems i missed the part  application_surface_draw_enable(false);

(+1)

Oh! that makes sense :D Since when this is enabled, GameMaker automatically draws the application_surface over the Crystal drawing, which makes it seem like it didn't work. I'm glad it worked now!

(1 edit)

This looked really good and I'm sure it is once you figure out how to use it, I have spent about 5 hours on it and cant get it to work, not even the most basic of setup, followed guide up to Shadows


EDIT - Clearing cache and reimporting resolved issue, great tool!!

(1 edit)

Hello! Thanks ^^

Did you follow the Quick Start guide? Which part exactly are you having trouble getting to work? Take a look at Troubleshooting.

Edit: Oh, I'm glad it works now ^^ thanks!

(2 edits)

Hello! I have a strange problem: the shadow is drawn on top of the sprite, not underneath, as in the demo.


CREATE: 

// Shadow

_shadow = new Crystal_ShadowSprite(id, sprite_index, image_index, CRYSTAL_SHADOW.DYNAMIC);

_shadow.shadowLength = 0.1; // Numbers close to 0 will prevent the shadow from moving too much with the light. 1 = same distance as the light.

_shadow.fixedBase = false; // The shadow WILL offset

_shadow.followLightAngle = false; // The shadow will NOT rotate based on the light position

_shadow.Apply();


STEP:

//Shadow x/y/depth

_shadow.x = x;

_shadow.y = y;

_shadow.depth =  depth + 1;


UPDATE: Sorry! My fault: gpu_set_ztestenable(true);

Hi, oh yes, you need to enable depth buffer so you can depth sort things

i wish this plugin would be available for godot as well 😒 it looks incredible

(+1)

Thanks for your interest, Godot is a great engine, but I only use GameMaker ^^', maybe you could try GameMaker? πŸ‘€

Gdscript feels simpler for me plus,the benefits on godot are outweighing gamemaker for me.i wish you well on your projects 😁

Thank you! I wish the same for you too :D

(+1)

thanks 😁

Hello, this is a magnificent lighting engine! 

I 've been working on making my particle(depth sorted) effects not affected by lights and shadows, referring to the documentation and sample project.

Is there a recommended approach that allows rendering that is excluded from light/shadow  with depth sorting?

I first tried using the EMISSIVE pass, with the following code: crystal_pass_submit(CRYSTAL_PASS.EMISSIVE, draw); 

However, using EMISSIVE changes the appearance of the particles. So I tried the COMBINE pass, which rendered the particle with the exact appearance I wanted, but it did not support depth sorting. 

Thank you so much!

Hello! Thank you for the kind words ^^

Yes, this is indeed a common problem, and depending on the effect, such as smoke, it might be better to draw the particle system manually at the desired depth and use a Direct Light with litType = LIT_EQUAL and intensity 1. This way, the light will illuminate only the depth where the particle is (you need to modify the light depth all the time in your case). And in fact, the Combine pass doesn't support depth because this is drawn after the lighting system is drawn (but on the same final surface).

Thank you for the prompt reply! 

I tested the suggested method on my project, but since the depth of my effects and objects changes dynamically, unintended objects get illuminated when they share the same depth. 

Is there any way to bind the light to illuminate only specific instances, instead of restricting by depth using `LIT_EQUAL`?

Or any other good approaches would be appriciated.

You're right, this is a limitation compared to forward rendering, where shaders are applied to each object individually (you just need to skip the lighting calculation to get something unlit). Since Crystal uses deferred rendering, everything naturally receives lighting, so to get something "unlit", you need to light it. The other alternative is to use the Combine pass, but it can only be drawn after everything.

(+1)

OK, I get how the engine works now! 

The "unlit" issue (excluding objects from lighting) is something I think I can work around in my project now, so that's solved for me.

However, the issue with the "EMISSIVE pass visual change" is definitely getting into the engine's internal settings, so I'd like to send you a few more detailed questions via email to discuss it further!

Thanks a bunch for your help! :)

I asked it on the GM forums, but figured I'd ask here too. The "castle" scene in the demo is almost exactly what I need, but the transition from "in front of light" to "behind light" is really jarring, going from fully dark to fully lit immediately.

Is there anyway to utilize something like the "light penetration" feature to give it a 1px edge light while the light is behind or beside the sprite? Or maybe more than 1px, depending on light angle, so that as the sprite comes up alongside the light, it lights it more fully, rather than just snapping to a lit state?

If there was a way to do this, I might be convinced, but $60 is a high price tag to experiment with, you know?

(Also the "toggle dithering" feature on the castle demo doesn't work. Nothing toggles on or off for me.)

Hello!

Regarding the depth change, this is because I'm using depth = -y for depth sorting, and since the game is still 2D, the light is just a "plane," and they're organized into layers, like other things. You can simulate smooth transition by applying a shader that darkens the tree depending on the light's position (but this isn't included).

I need to make it clear that it's more difficult to deal with depth in 2D if you're trying to imitate 3D perspective, like in top-down Zelda-like games, but it's possible to get good results.

Yes, you can change litType to LIT_ALWAYS. This will make the light always stay on regardless of the depth. You could also experiment "normal maps".

What graphics card do you have? AMD or NVidia? I can try to fix that.

I understand the price issue. I sometimes offer discounts, so you can follow me to be notified. You can get a refund if Crystal does not deliver what was described.

I guarantee you won't regret getting Crystal, it's currently the most complete library for GameMaker, and you have complete freedom with it.

Thanks for the quick reply! And the pricing would completely be worth it if it solves what I need. I'm on NVIDIA, if that helps.

I'm definitely not good enough with shaders to write something that would give that gentler lighting effect I'm after. Shaders are hard as hell, so kudos for what you've written.

Is it possible to toggle both "plane" lighting and put a normal map edge lighting effect on top of it, like you demonstrate in the docs you sent? I know that often times these different draw methods are organized as separate functions in libraries like this.

(3 edits)

You're welcome

Yes, it is completely possible to combine both methods. Edge lighting is a property of the light (light penetration), and normal map is a property of the material

What is your specific GPU model if I may ask? I have a GTX 1050 TI and it works fine

(+1)

RTX 2060, but the laptop version. (My understanding is that desktop and laptop version of graphics cards differ slightly.)

Hello! This looks absolutely awesome, thank you so much for your work! Just wondering - If I were to use this and design my game using the default 2D room editor, but then used projections to make my game 2.5D, would that break the lighting system? Or would it continue to work in 2.5D?

Hello!

Thank you for being kind! ^^ Crystal only works with orthographic projection cameras.

(1 edit)

Of course, your libraries look like must haves! I'm hoping they'll continue to be updated to work with GMRT. ^^ And I see! Does that mean if you were to technically have a 3D scene, but the camera was orthographic then it would continue to work too? =O

Hello, could we possibly get a manual to see how the library is structured and used before purchase? Also, is the Tokyo Ride showcase screenshot using any other libraries? By that, I mean the "Post Processing FX" library.

Hello! Of course, the manual is publicly available here:

https://kazangames.com/assets/crystal/docs

Yes, I used Post-Processing FX for the bloom effect, and Crystal's emissive materials for the stuff

(+1)

Thanks for the quick response :)

(1 edit)

Sorry for asking how to create such a shadow 

Maybe there is a code for creating a shadow exactly like a branch, so that it is reflected without rotation, etc.

(+1)

Hello! I just added it to the documentation about Sprite shadows, I hope this helps ^^

Thx. But x, y dont work. If I do shadow.x = x, shadow.y = y in step, nothing works... 

(+1)

The shadow should be dynamic and not static.

Hi! After updating to new versions of Light and Postprocess Engines, the light stopped working. Before that, everything was ok... Maybe something changed?

(+1)

Hello! Check if lights are still children of light parents after updating. Is there any other additional information about this?

I've bought this engine and am enjoying getting started; however, I am still confused by how to generate shadows for an animated 2D player character. I believe I need to create a dynamic shadow and a Crystal_ShadowMesh(). 

But I'm confused by the workflow--the documentation links to a tool here (https://web.archive.org/web/20240712103410/https://adriano-t.github.io/meshgen/) for creating a list of points by hand, but it appears I need to do that for every frame of my character and then use the Crystal_ShadowMesh().FromJson method. That seems like a lot of manual work. Is there no automated method, or is that indeed how to create an animated shadow?

(+2)

Hello! What you want will be available in the next update (v2.0), which is scheduled to be released soon.

(+2)

Deleted 117 days ago

Will such shadows be built automatically?

(+1)

These shadows are sprites, so yes. Additionally, I also added functions to create vertex shadows using ray tracing.

OH MY F. GOD! Bro, WHEN? I can't wait to touch them)

(+1)

Just released! :D Have fun :)

(+1)

Hey, it seems that I was late for the vacation sale. Does anyone know when it's going on sale again?

Strange problem, I create a normal material (in the example when I insert everything works ok), and my normal map does not work when lighting... I've racked my brains and can't find the problem...

material = new Crystal_Material(id);

material.normalSprite = spr_floor_s04_n_1;

material.Apply();

// Create system responsible for rendering lights, shadows, materials, etc.

renderer = new Crystal_Renderer();

renderer.SetRenderEnable(true);

renderer.SetDrawEnable(true); // disable it if using post processing

renderer.SetMaterialsEnable(true);

renderer.SetHDREnable(true);

renderer.SetCullingEnable(true);

renderer.SetCullingSettings(300);

renderer.SetLightsBlendmode(CRYSTAL_LIGHTS_BLENDMODE.MULTIPLY);

renderer.SetAmbientColor(c_black);

renderer.SetAmbientIntensity(0);

// Enable depth buffer and alpha test

gpu_set_zwriteenable(true);

gpu_set_ztestenable(true);

gpu_set_alphatestenable(true);

gpu_set_alphatestref(1);

application_surface_draw_enable(false);

(1 edit)

Hello!

You can only see materials if the light's shader is Phong or BRDF. By default, the light's shader is Basic. Also, take a look here.

I hope this helps :)

The Mac demo doesnt seem to want to run on OSX 15.5 Mac Studio.

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)

Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000030

Exception Codes:       0x0000000000000001, 0x0000000000000030

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11

Terminating Process:   exc handler [44161]

Hello Matt

I think your OS version is too recent compared to the compiled file (?) Could you test the Windows version?

(1 edit)

Hey. I followed the instructions in your documentation, both in my main project as well as in a blank project. I can't get a single point light working. Even copied code from the example project, still doesn't work. It's just a black screen. I'm using IDE v2024.13.1.193

Hello! Could you send me your project privately in Discord so I can take a look? Sometimes it can be a silly mistake like an incorrect configuration, but I can help you. Are you sure the object is in the room?

Hi, is it possible to exclude certain object instances from being affected by the lighting system? For example, I want some instance's icons or markers in the game to remain unaffected by lights, shadows, or day/night cycles.thanks!

Hello!

Yes, I prepared a tutorial recently explaining this, check out this link (Troubleshooting).

I hope this helps ^^

(+1)

Thanks!!! got it.

I have another question.  When I set SetMaterialsEnable(true), the instance is drawn twice—once in Draw and once in Draw GUI (with one being a ghost image that doesn't update when the object moves). Why does this happen?thanks

(1 edit)

Crystal should never be drawn in the Draw GUI unless you are calling the .Render() function in the Draw GUI event (which is not recommended)

(1 edit)

Hi, I purchased your asset today, but I’m not seeing the bloom effect in your Example project. I tried modifying the objInit Create event by adding instance_create_layer(0, 0, "Managers", objPostProcessing); but this causes the game to crash.

Do you have any recommendations on how to properly enable the bloom effect or set up the post-processing? Any help would be greatly appreciated!

Thank you!

(3 edits)

Hello! Thank you for purchasing Crystal, I hope you like it ^^

As mentioned in the welcome message, I used Post-Processing FX (my other library) to demonstrate Bloom support with Crystal for emissive materials (since this is the only way to see it working), but this is not included in the source code, as it is a post-processing effect (screen-space effect), which is outside the purpose of Crystal, which is a light and shadow system in world-space.

Hope this helps :D

(2 edits)

Yes, I have both assets, and I’ve already imported Post-Processing FX.
However, when I try to set it up, I get this error in the Create Event :

Variable <unknown_object>.PPFX_Renderer(102732, -2147483648) not set before reading it.
 at gml_Object_objPostProcessing_Create_0 (line 4) - renderer = new PPFX_Renderer(); 

Could you please help me figure out what’s causing this and how to properly connect the bloom effect with Crystal?

Any guidance or example would be really helpful.

Thank you!

(3 edits)

Join my Discord and send me the project privately so I can take a look if possible, but I believe it is because in v5.0 of PPFX, "PPFX_System" became "PPFX_Renderer", and in the example this change has not yet been reflected yet.

Edit: User's issue has been resolved.

Man I've been waiting for a sale for months to buy this, you telling me there still isn't one during the summer sales TT ?

Vacation Sale is now available, enjoy! :)

(+1)

Oooo nice timing then- I just gotta wait to get my salary and I'll finally be buying this :)

Thanks! I'm sure it will be very useful in your projects :D

So I've bought it and literally nothing works idk what I'm missing- I'm gonna sound like the guy that didn't read the documentation but I swear I did TT I'm on IDE v2024.11.0.179 and Runtime v2024.11.0.226

 I imported the package in my game and I've just followed the Getting Started tutorial in an empty room separated from my entire game, put on a background, enabled view port, checked the parent objects... Nothing appears. Not even the debugging tool can appear. The only weird thing in the code that might help find the solution is that I get a yellow "String Not Found" underline on a couple of lines such as renderer.PreRender(),  renderer.Render(...) and others, but I don't know what to make of that.

I would appreciate some guidance because I don't know what did I miss 

(1 edit)

Oh, send me the project on Discord (privately) and I can diagnose it for you. Sometimes it's something silly like the object not being in the room ^^

Edit: User's issue has been resolved.

looks like I just missed it

(1 edit)

I waited like 6 months for this to go on sale and it didn't so i guess we're done waiting, though.. i'm still looking out for a sale on ppx.. But hey, i finally have a summer to mess around with it and maybe put it into some games, Bulb is currently doing pretty alright for me but light depthing, normals, light sprite animation, and pixel art light effects are pretty appealing. I doubt i'll need some of the fancy stuff like reflections but you never know, eh? Maybe some art direction makes that feel like it belongs and suddenly i'm glad to have it. Anyway, thanks for making this foxy, time to see what I can manage to use it for.

Vacation Sale is now available, enjoy! :) 

Thank you very much for the support! have fun ^^

(+1)

Well that means I can get ppx now too, why not. Price aside these are some damn good assets foxy, you're doing a service to the GM community and I for one appreciate the opportunity to use this level of lighting tool without having to get into the mechanics myself lol. I'll try to make some scenes worth showing off and make you proud. Until then, see ya 🫑

Hi. I bought it! First of all, I checked how Spine 2D animation works.

Do I understand correctly that it is necessary to make 2 spine animations - albedo and normal? (This will be easy inside Spine2D).

For metallicity, emissivity and roughness, do I also need to create each Spine sprite?

Hi!

In principle it works the same as bitmap sprites, you need different sprites (albedo/color, normal, roughness, etc), each of which will be drawn in a different pass: normals, etc. You can use Crystal_Material() or submit your own code for each pass using crystal_pass_submit(). I suspect it is possible to do this using skins in Spine? (but I believe you have to use crystal_pass_submit for this).

Thank you for purchasing, I hope you enjoy it ^^

Does this support diffraction shadows (e.g. sharp edges when close but fuzzy/blurred edges far away from the occluding object)? Also, do you ever offer sales on this asset? It looks very powerful!

Hello AlaskaWorks,

Yes, there is support for penumbra and umbra for shadows.

I usually do sales during periods when Itch.io announces sales. Follow me so you can stay up to date with future sales ^^

(+1)

Vacation Sale is now available, enjoy! :) 

(2 edits) (+1)

This looks absolutely incredible, I can't believe I haven't stumbled upon this sooner, before spending an unhealthy amount of time trying to implement some of these features into other lighting systems. 

Special thanks for the .GetLightsCollisionAt(), just what my stealth game needs. 

That's great to hear! Thank you so much, it means a lot to me ^^ have fun

Hi, it's me again. I have 2 questions.

1) is it possible to use a fixed value in edge lighting (light penetration) that does not depend on the distance to the light source?
For example, I want the penetration to always be 16px.

2) is there an implementation of fake AO for topdown in the lighting engine like in the screenshot here? (look at the floor around the object)

Thank you very much in advance!

Hello Nakkazuka!

1) Yes, but you wouldn't use the light penetration feature, but rather draw it using normal maps. This way you can customize how many pixels the light will pass through and stuff like that. You need to change the light shader to Phong or BRDF too, to support normal maps. See: Creating Assets

2) Yes, there is support for Ambient Occlusion, through materials (sprites) or AO pass in general (cystal_pass_submit()).

Thank you! I will be buying the asset soon.

This light engine has everything I need, especially spine2D support (normal/material rotation, bone scaling, etc.)

Thank you! I hope you like it, and if you have any questions, there is the Discord server :)

Hi! I really really like the asset as of now and it was really easy to setup. I have two issues at the moment, however:


1. Maybe I'm misunderstanding how to use sprite shadows, but it seems they always have the same depth. If I have two trees with one behind the other, is there any way to have the sprite shadow cast to also "hit" the tree behind? Maybe I'm missing something here, but I can't figure out how to have different depths for sprite shadows. If this is not intended, is there some workaround?

Also, is there support for the shadow being distorted by the object behind? So for example, if part of the front tree's shadow hits the tree behind, the shadow would not be cast in the same wayas on the flat ground but look a little distorted (on the tree behind)


2. Is there a way to have a fall off for sprite shadows? Kind of like a mixture between the shadow for the character in the top down/castle demo and a sprite shadow.


Thanks in advance for any help!

Hello!

- What determines the depth of sprite shadows is the depth of the ShadowGroup, since sprite shadows are drawn inside a surface, to apply a blur later (if desired).

Remember that all these shadows and lights are 2D simulations with depth, and do not work like in 3D, where the shadow reaches everything dynamically, so it can be a bit tricky to adjust the depth, unfortunately this is a problem in 2D games in general.

- This is only possible for Vertex Shadows currently.

You're welcome ^^

Thanks for your quick reply! :)

Ahhh, I see. Performance wise, is it an issue to create a group per sprite shadow/object to have individual depth values per shadow? 

Can we access the buffer/surface the sprite shadows are drawn on and render them individually?



Also, ist it possible to find out whether and where an object is collides with a (sprite) shadow? This would be interesting because - if there is access to the sprite shadow buffer(s) - the shadow could be distorted by other objects behind the one that casts the shadow to mimic a more three dimensional shadow.


Vertex shaders look really cool, but they act more like occluders, right? Or are the mesh shadows able to cast shadows similar to sprite shadows where there is a certain shape to them?

Creating a group for each shadow would be extremely cumbersome, since it would mean 1 full-screen surface for each shadow.

I was looking at the code and it looks like I can add depth support via the depth buffer. This would make it possible to have just 1 group with multiple shadows at different depths. I'll look into that later.

You can detect collisions with shadows and lights using .GetLightsCollisionAt()

Yes, all shadows have the functionality of blocking light, except sprite shadows, which also allow drawing in ambient occlusion pass.

(2 edits) (+1)

Depth support via the depth buffer would be amazing, thanks for looking into that!

I see, so only when using vertex shadows, you could have objects blocking light? My only issue with vertex shadows is that they seem to be less fitting for games with a 3/4 perspective whereas sprite shadows look more natural to me in those settings. But I'll look into what you can do with vertex shadows a little more.


Edit: This video by FriendlyCosmonaut shows the type of shadow I'm trying to integrate. Thag's only possible with Sprite Shadows, right?

It is possible to create this type of shadow with vertex shadows as too, but you would have to draw the shape per vertex. Otherwise, yes, Sprite Shadows will use the shape of the sprite. In the next Crystal update, there will be a function that creates vertices based on the sprite's outline.

Is it possible for the Crystal_TimeCycle() method to exclude specific objects or instances from being affected?

Hello!

The day and night cycle only changes ambient light (using LUTs), so you have a few options to do this:

A) Add an emissive material;
B) Add a direct light (with the same depth and litType = LIT_EQUAL);
C) Draw it in the combine pass, using crystal_pass_submit;

Thank you. I have another question: When I add an outline shader in the draw event, it causes issues with the rendering of lighting and shadows. How can I correctly use the shader without affecting the display of lighting and shadows?

Hmm, any shader should work normally, I suspect it might be the alpha testing? (gpu_set_alphatestenable etc)

Could you show how you're doing this on Discord? 


The first image shows the mouse is not on the chair, while the second image shows the mouse placed on the chair. An outline shader has been added to the second image. I don't understand why this is happening—gpu_set_alphatestenable is set to true.

(1 edit)

See: 2. When a transparent object passes over another, it occludes

"If you are using shader_set(), you may have to do the alpha test manually within the fragment shader. This is because GameMaker does not add the DoAlphaTest() function to the shader internally"

Heyo! Thank you for the amazing libraries! I was just wondering if you offer any bundles or deals?

(1 edit)

Thanks ^^ I usually do sales during periods when Itch.io announces sales. Follow me so you can stay up to date with future sales ^^

(+1)

Hope for sale soon im interested too this looks good :)

Hello. Nice engine.
1) I might have missed this, but does this light engine implement ambient occlusion for objects? For a top-down perspective, this is pretty relevant.I want to get a very soft black outline around an object (with adjustable thickness and strength), for example for a box.
2) for a top-down perspective, can I implement a reflection of a puddle? for example, so that the puddle would reflect the nearest box and light? I'm thinking about creating wet floors with puddles.
Thank you!

(1 edit)

Hello!

1) Yes, a Crystal_Material() can be applied to objects and allows you to add ambient occlusion. It can also be applied to layers using a Crystal_MaterialLayer (I am using it in the first platformer example - the brick wall)

2) Yes, you can add reflections using Materials too, and it is also possible to write your own code and submit it to the renderer using crystal_pass_submit()

I hope this helps, thanks ^^

Hi! Thinking about getting the engine, it looks great!. I read through *some* of the documentation. Quick question: my game currently makes heavy use of tile layers in rooms, I assume it's also possible to get materials (normal maps mostly) to work with tilesets/tile layers?

Hello! Thanks for the kindness ^^

Yes, definitely 😁 it's possible to use Crystal_MaterialLayer and select many ranges of layers (tilesets, backgrounds, assets, instances etc), being normal maps, PBR Materials, and more.

hello! looks awesome. If I buy this, will i get access to any possible future updates?

Hello! Thanks for the words ^^

Yes, whenever there is any update, you will receive it for free.

Nice to know.


Also, Ineed to know if there is an extensive documentationthat explains how to use everything.

I'm really new at programming, and Ihave managed to create a funcional game with game maker reading thedocs. But Ineed this to be well documented to be interested.

Of course :)

I even wrote tutorials, including FAQs (troubleshooting) and a "Getting Started" guide:
https://kazangames.com/assets/crystal/docs/

There is also my Discord server where you can ask questions there.

The game I'm currently working on uses pixel art, but has an application surface size higher so movement isn't snapping to each pixel. I'm wondering if I could make the shadows and lighting snapped to each pixel, while still keeping the application surface size larger?

(1 edit)

Hello, yes, you can create your own final render pass based on the original, using .SetRenderClass(), and pixelate the pixels in the situation you described.

Is it possible to detect if an object is in a lighted area (or shadow area)?

Hello!

Yes, with .GetLightsCollisionAt()

Hi!

I already have a game with a few levels and I wonder how difficult it will be to implement this lighting system into my game? Is it based on adding a controller object and light sources and some special layer?

Hello!

It's very easy; Yes, you create a manager/controller for the lighting system and add the lights to the room, using layers/depth or via code. You can check out this quick start tutorial:

https://kazangames.com/assets/crystal/docs/#/./pages/quick-start

Hi! I'm thinking about switching to GameMaker Studio for a pixel art/top-down game and would like to use your lighting engine. From the demo and the images here, it looks absolutely stunning and exactly like what I've been trying to do myself, but much better and more flexible! I'm still a little unsure about some aspects after playing around with your demo and reading some of the documentation, maybe you could help me out. I'd appreciate any help!

1. Is the shadow-color adjustable and can you determine how much blur you apply? In general, but also for sprite shadows specifically.

2. In the pixel art/castle room, it looks like the shadows of the bushes below the tree are sprite shadows that can be stretched/bent similar to the video here: https://www.youtube.com/watch?v=haU-lUkitas. Is that actually possible? It looks like the sprite shadow projection from one of the images does that, but I would like to make sure. I would like to use this for sprite shadows the imitate how the shadow of objects changes over the course of the day.

3. Can a daylight cast dynamic sprite shadows without actually altering the scene visually? In other words, I would like to add a daylight that casts sprite shadows, but the scene otherwise looks as it would if no light is placed.

4. If you place a light, can you determine where the falloff should start and how fast it should end? I.e., can I create a light with the shape of a circle and, say, a radius of 50 pixels and decide up until 40 pixels out, the light strength stays identical and then falls off in the last 10 pixels or is this predetermined and the same for all lights?

5. For your other projects, you mention that all platforms are supported (including consoles and iOS). Do you think this one does as well or is there a specific reason why it might not work on consoles, for example? I'm asking because the demo crashes for me on the latest macOS version and I can only run the Windows one.

6. At worst, my game would have around 4000 sprites to render, of which maybe 50-250 are visible on screen at any time and would cast a sprite shadow from daylight as well as, in theory, multiple sprite shadows from additional lights (campfires, streetlights, etc.). These would be dynamic shadows. Will I presumably run into an issue here on (lower end) mobile platforms or is that fine from your experience?

7. Is it okay to make changes to your code when using your lighting engine in a project?

Hello Elias, thank you so much!

Of course, if you want to join Discord, you're also welcome 😊

1. Yes, the color of the shadows is defined by the ambient light. It is possible to add blur natively to sprite shadows, and you have full control of the blur amount, resolution and others.

2. Yes, in fact, this video was one of my inspirations ^^, but in Crystal I optimized to use vertex buffers that are frozen instead, and rendered with just a single draw call, if they are baked, making it more performant.

3. Yes, you can add lights with shadows even if the ambient light is at 0 intensity, and you have full control over the intensity of the shadows.

4. Yes, you can use "inner", "falloff" and "radius" parameters to get this result.

5. Crystal uses pure GML code, with no external dependencies, so if it doesn't work on other platforms it could be a GameMaker issue. The shaders are written in GLSL ES, which is highly supported on all platforms, and I don't use noise functions currently, which are known to cause issues, so it should work fine. The MacOS demo was not compiled by me, as I don't have a Mac computer, a user helped me with that, so it's a bit out of my reach. If something goes wrong, just tell me how to reproduce it and I'll fix it quickly.

6. Currently shadows that have dynamic projections are somewhat limited. They cannot move x and y, as they were made for scenery, using a shader to move the shadows. Only normal sprites (without projection) can do this. I have plans to improve this in the future.

You can use vertex shadows instead, which can be used both dynamically and statically, and can be moved freely.

7. Yes, you should :)

Crystal offers a lot of customization, including using crystal_pass_submit() to submit custom code for a render pass. It is possible to completely replace the final shader using .SetRenderClass()

(+1)

Thank you so much for your detailed answer, I really appreciate it!😊 Sounds like Crystal is perfect for what I'm trying to do!

I was reading the license and I just wanted to confirm; It says that it needs to be bought again every time a commercial project is published.
I think that's understandable, but what about non-commercial/freeware projects? Does it need to be re-licensed again? Does a free game published on a store like Steam count as a commercial project?

Hello!

If there is no capital gain in the project, you can use it in as many projects as you want. Just remember that the project cannot be open-source, as it would fall into the redistribution category.

(+1)

Understood. Thank you!

This engine is pretty cool and I'm pretty sure it'll have what I need but I'm still learning how do specific stuff with it.

I'm making a top down shooter (hotline miami perspective) and I'm trying to implement overhead lights but I don't really know how to do that. I'm looking for a way to make a light that'll cast longer shadows on objects further away, but as the object moves closer to the center of the light the shadow becomes shorter until when the object is directly under the light, there is no shadow and the object is fully basked in light. 

There are two ways to increase the shadow length:

A) Using the shadowLength variable in Crystal_Shadow. You can set it to 20, 40, or more, so that the shadows will go further.

B) Modifying the shadowScattering variable, per light.

Thanks for the kind words ^^ Crystal will be perfect for the hotline miami style.

How is the shadowLength variable used? In my tests it looks like it multiplies the size of the base shadow mesh in order to achieve its length, but I'm not 100 percent sure.

Additonally, how does the depth of light and shadow casters affect anything? I'm also having trouble getting certain objects to render above/below light sources and I figure this has something to do with that.

Apologizes in advance if I have a lot of questions, I'm pretty new to this and sometimes the documentation can be a bit unclear to me.

(1 edit)

By setting shadowLength to 1, the length of the shadow will be equivalent to the distance from the light to each vertex of the shadow, in pixels. 2 will be twice that, 3 will be three times that distance, and so on.

To modify the variable, just do shadow.shadowLength = value;

All relevant information related to depth can be found here: Troubleshooting.

No worries, feel free to ask any questions you may have :)

(1 edit)

Alright, thanks. I'm also having issues with soft shadows. On the documentation under the light types section, the direct light preview shows the shadow almost fading out into the light, and I've also seen this behavior in some of the test rooms provided. However, my shadows appear to have hard cutoffs instead (im using SHADOW_SOFT_TRANSFORMED) and don't fade out.  (see img, i'm using a spotlight here but the same issue is still there when i do use a direct light)


Also, soft shadows with a low shadow length appear to not be completely softened, and only the vertexes of the shadow are not the edges in between, however I'm assuming this is intended behavior. Either way, how do I replicate the effect shown in the direct light preview?

This can be solved by setting the light's shadowUmbra to 1

(+1)

Yet another amazing extension! I really like that you utilizing the depth buffer to limit the number of surfaces needed for render pipeline sorting

This definitely makes a big difference, especially on low-end platforms with little VRAM :D

Thank you, constlet!

(+1)

Congrats on the release, looks great!

So in my 2d side scrolling game game I have lots of layers  grouped into foreground, middle ground and background, each has their own lighting system and is not affected by previous group. IE backgroun should not be lit by lights on middle ground. Right now I am drawing middle and foreground on different surfaces, not a fan. Would you suggest your engine for my game?

(1 edit)

Yes! It is entirely possible to use Crystal for your game. You can illuminate the layer using a Direct Light and a different litType. Thanks ^^

(1 edit)

Thanks! I have actually looked around since I posted and I see I can accomplish it per layer via LIT_EQUAL. But I have 20 different background layers, 30+ middle ground layers, 10 + foreground layers. I don't think I can do the lighting on a range of layers, ie light  layers from depth 100 to 2000, and another light to light layers from 2000 to 3000 for example?

(2 edits)

You have some options:

  • Having a Crystal_Renderer for each surface (which is not ideal);
  • Add a Direct Light to each layer you want to illuminate;
  • Use a Crystal_MaterialLayer, which allows you to render the layers in range in some pass, at different depths.
(+1)

Ah I see, thank you!

(+2)(-1)

Been waiting for this lighting system! Got the holy foxy trinity of managix, crystal, and post processing FX! Can't wait to really put them to use in our HD game, you're saving me thousands of hours! Special thanks indeed, and to all wondering if you need this? BUY YOU FOOLS

This means a lot to me! I’m so glad the holy foxy trinity is going to good use and I can’t wait to see what you’ll do with it in your game 😁
Saving thousands of hours seems totally worth it, isn't it? 😌 Thanks for the kind words!

(+1)

Absolutely fantastic, been waiting for this to release, so excited to give this a try as soon as possible ^^

I'm glad you like it!! If you have any questions, don't hesitate to ask :D

(+1)

Looking awesome, is there going to be a demo for Mac?

(2 edits)

Thank you! I can't provide it, sorry... If you wish I can provide videos demonstrating (or see my Twitter)

I can provide you with a Mac demo, now that I have purchased this great pack! Let me know if you are interested?

Kind of you, that would be interesting ^^ in your time

I have put up a blog post, https://conceptalpha.co.uk/crystal-lighting-engine if you just want to download and it add it to this page that's fine. I can remove the post when you're done.

Added, thanks! ^^

Viewing most recent comments 1 to 40 of 48 Β· Next page Β· Last page
Side-scrolling game scene with a character riding a dinosaur, brick walls, hanging lights, and a statue.Pixel art city street at night with neon lights, a character walking, and text dialogue box visible.Grid of eight game graphics examples showing different shadow, lighting, and perspective effects with labels.Grid of eight game screenshots showing different shadow and lighting effects with descriptive labels below each image.Grid of eight panels showing different lighting shader effects and UI features for a game development tool.Colorful underwater city scene with neon signs, glowing jellyfish, and futuristic buildings in the background.Platformer game screenshot with glowing lights, a character, and UI elements in a dark brick environment.Pixel art scene of a character outside a lit house at night, demonstrating lighting effects in a game engine.Pixel art game scene of a character holding a shield in a dimly lit stone hallway with limited visibility.Game engine UI showing lighting options, light maps, and a 3D scene with glowing cubes and debug overlays.Colorful glowing cubes and light effects on a dark background with text promoting lighting features.Futuristic game scene with glowing machinery, neon lights, and a character in a dark, tech-filled environment.Color picker interface with two color wheels, color swatches, HSV, RGB, HEX values, and adjustable sliders.Game engine editor screenshot with lighting controls, inspector panel, and a character scene with lanterns.Top-down game screenshot with colored light effects, a character, crates, and a lighting settings UI panel.Top-down game screenshot with green fog of war effect, checkerboard floor, and visible lighted corridors.Cartoon character in a spacesuit riding a dinosaur with glowing crystals and the word 'Reflections' above.Colorful lighting effects on geometric shapes with a glowing textured cube and overlayed interface text.Platformer game screenshot with colored lighting, brick walls, hanging lamps, and a glowing statue on the right.Game UI with adjustable sliders for light settings, a globe, and green light beams on a dark grid background.Dark game scene with a cat silhouette holding a flashlight, illuminating a checkered floor pattern.Cartoon bee hovers near stacked wooden crates on a dark checkered background with a green glowing circle.Pixel art character with blue hair stands in a dark area illuminated by a circular light source.Four-panel meme with a blue bird rejecting 'any library' but eagerly eating 'CRYSTAL LIGHTING ENGINE' and looking pleased.