Shadow casting

Hi, I just started using Corona, I want to add shadows to my project and I’m surprised that it’s not integrated and that there is no plugin in the store. I’ve found this one:

https://bitbucket.org/reneaye/corona-2d-shadow-system/

Downloaded the repository and when I tried to open it got this error “File: module ‘2dshadows.util.log’ not found”. Is this still usable or am I doing something wrong? I just started the main.lua from the repository and got this error.

I saw the post also from XeduR @Spyric and I know that he is in the process of making a plugin.

Can you please help me with this and tell me if there are some other options?

If I remember correctly, you’d need to clone the repository as it includes those util files. The download that’s available on the page doesn’t have them.

René’s shadow system contains a lot more visual flair than mine, like those lens flares, etc. which also makes it more costly to run. My system simply does the calculations and returns a shadow per object made out of a single polygon. As that repository hasn’t been updated since I last had a look, there are a series of issues there concerning some odd flickering, inaccurate shadow shapes, the shadows catching up, etc. Still, as he mentions, the system was an experiment and I got the idea for how to implement shadows for cylinders in my system based on his approach, not to mention that my entire project is inspired by his. :stuck_out_tongue:
 

Now, the silly thing is that my shadow system has actually been complete for quite some time. I just haven’t taken the time to turn it into a plugin, i.e. it’s a lua module for the time being. The main reasons for that have been me being busy with work and other projects, like currently I’m writing the Twine/Yarn plugin, and I still want to add one extra bit of functionality to my shadow system. Currently the shadows are all cast based on the assumption that the objects are on the ground, but with a few minor tweaks, the system should be able to cast shadows for objects that are not glued to the ground (or background).

It’ll take me some time to get around to making it into a plugin, but the actual process of doing so shouldn’t take more than a few hours. With my work and the story plugin, I’d say I’ll have the shadow system ready as a plugin by 10 February at the latest. If cloning René’s entire repository or waiting for me to finish turning mine into a plugin doesn’t suit you, then you could also look into creating a similar system by yourself. If you do, I can give you some pointers on how you could approach it.

Hi XeduR, thank you for the detailed response, I really appreciate it. I would prefer to wait for your plugin, I would like to learn how to do it but right now I am busy with learning the basics here and translating my project from spritekit. I started 2 years ago with swift as my first language and jumped right into spritekit to build my idea. Had lots of short and long breaks inbetween and changed my project multiple times as my skills improved. Decided to do it with Corona at the end, wasn’t happy with some things. So I can wait and implement the shadows later because I need more than a month now.

The objects are on the ground, you can pick them up, move and drop. There is only one light source. Spritekit has just long casting shadows and I was ok with them. Would like to try it also with the short shadows that your plugin provides.

Thank you again XeduR, looking forward to your plugin!

If I remember correctly, you’d need to clone the repository as it includes those util files. The download that’s available on the page doesn’t have them.

René’s shadow system contains a lot more visual flair than mine, like those lens flares, etc. which also makes it more costly to run. My system simply does the calculations and returns a shadow per object made out of a single polygon. As that repository hasn’t been updated since I last had a look, there are a series of issues there concerning some odd flickering, inaccurate shadow shapes, the shadows catching up, etc. Still, as he mentions, the system was an experiment and I got the idea for how to implement shadows for cylinders in my system based on his approach, not to mention that my entire project is inspired by his. :stuck_out_tongue:
 

Now, the silly thing is that my shadow system has actually been complete for quite some time. I just haven’t taken the time to turn it into a plugin, i.e. it’s a lua module for the time being. The main reasons for that have been me being busy with work and other projects, like currently I’m writing the Twine/Yarn plugin, and I still want to add one extra bit of functionality to my shadow system. Currently the shadows are all cast based on the assumption that the objects are on the ground, but with a few minor tweaks, the system should be able to cast shadows for objects that are not glued to the ground (or background).

It’ll take me some time to get around to making it into a plugin, but the actual process of doing so shouldn’t take more than a few hours. With my work and the story plugin, I’d say I’ll have the shadow system ready as a plugin by 10 February at the latest. If cloning René’s entire repository or waiting for me to finish turning mine into a plugin doesn’t suit you, then you could also look into creating a similar system by yourself. If you do, I can give you some pointers on how you could approach it.

Hi XeduR, thank you for the detailed response, I really appreciate it. I would prefer to wait for your plugin, I would like to learn how to do it but right now I am busy with learning the basics here and translating my project from spritekit. I started 2 years ago with swift as my first language and jumped right into spritekit to build my idea. Had lots of short and long breaks inbetween and changed my project multiple times as my skills improved. Decided to do it with Corona at the end, wasn’t happy with some things. So I can wait and implement the shadows later because I need more than a month now.

The objects are on the ground, you can pick them up, move and drop. There is only one light source. Spritekit has just long casting shadows and I was ok with them. Would like to try it also with the short shadows that your plugin provides.

Thank you again XeduR, looking forward to your plugin!