Drop Shadow Image Generator

Hello! I made a simple tool, in C#, to automatically create drop shadow images from images I imported to Godot. It’s probably a niche thing, but since it’s simple and might be useful to someone, I’m sharing it here with you guys.

What it does

What the tool does is simple: it reads a set of images you select, and creates new images that are just the drop shadow of those images in some directory you choose. It is a Godot script, so no external software is needed.

Example of a generated shadow

For an input image like this one:

This shadow image is generated:

How to use

This tool is a Resource. This Resource can be stored somewhere in your project, and contains the generation settings you want, like the images you want to generate shadows for; when you edit the resource, the inspector displays the Generate button, which is how you generate the shadow images. It does not replace the original images, it just creates new ones at a specified output directory.

This tool is just a single C# script file you can drop in into your Godot C# project.

Why you might want this tool

I’m making a 2D grid-based puzzle game where I have objects that need drop shadows. I could use a shader for that, but that would not be very performant, since there is no benefit in not having these shadows pre-baked. So, I simply use a raster shadow image for each object, instead of generating one in real-time with shaders. Initially, I was making these shadows manually, with an image editor (Affinity Photo), using its batch jobs feature, but that wasn’t very practical.

So, yesterday, I had some time free, and I decided to make a fun little tool for automating that.

Maybe you can find a use case where you need a tool like this at some point. For that, I’m sharing this here with you, so this doesn’t just get lost in my archives.

Download

I’m sharing this tool in my GitHub. You can get the script file there, as well as more info on how to use it:
https://github.com/AderitoSilva/GodotDropShadowGenerator

Enjoy. :smiley:

6 Likes