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?
Viewing post in Crystal - 2D Lighting Engine comments
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()