Is it possible to cut Sprite into irregular shapes?

Godot Version

4.2.2

Question

For example, I want to cut the stairs out of the sprite without wasting too much area.

You could use a Polygon2D and UV mapping. Though I am not sure what “wasting too much area” is? What is the problem with a transparent sprite?

This is convenient, but wastes some transparent area.

So is it possible to cut irregular areas from the sprite like above?

When adding a sprite node to my scene, I can only cut a rectangular area of the sprite.

And why is that a problem? :thinking: Sprites have a rectangular bounding box anyway, and the surrounding area is transparent, so you’re not really wasting anything.

1 Like

I’d like to be able to add small objects like bottles to the transparent area so I can make the most of the sprite.

The transparent areas can show other sprites behind and above them, you could also add the image you want onto the source image. I promise godot is going to be better at rendering a rectangle than a “cut” shape.

It feels like we’d need more details, how are you using this image? Is it actually a tilemap that you are using (in which case: try adding another layer)? Is this sprite being using as part of a 3D model (check your model’s UV against it)? Are you worried about performance (use the profilier)?

It’s not that complicated.

All I’m trying to do is display as many images as possible in one small sprite.
I could cut this large ladder into several smaller rectangular sprite nodes, but that method is a bit tedious and I’m just curious if there’s an easier way to cut irregular shapes.

It doesn’t matter if the sprite node can only cut rectangular areas.

Then the polygon method is your best bet, it makes very irregular shapes. Though it’s going to be much harder to work with and less performant.

Thanks for the reply, maybe cutting the stairs into a few sprite nodes or changing their node type to tilemap would suit me better.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.