Drawing decals

GameMaker includes the concept of surfaces:

…you can use surfaces to “catch” instances, which can then be destroyed, and in this way you can create a decal effect where the sprite for the instance is displayed on the surface as if it still existed, permitting graphical effects like debris, blood, etc… without any real processing overhead. Another thing you can do with surfaces is use them as textures to be manipulated, or to create sprites “on the fly”, or to create complex overlays…

In other words, a surface can be thought of as a canvas you can draw on.

Is there anything similar in Defold?

1 Like

This extension comes to mind: GitHub - AGulev/drawpixels: Defold engine native extension for drawing pixels into texture buffer.

1 Like

Oooh interesting. Thanks!

1 Like

Would be interesting to make an extension which can handle stamping one texture onto another for this purpose. I’m not sure if we can yet get texture atlas meta data at the moment at runtime so it wouldn’t be super useful until then.

1 Like

Decals aren’t typically overwriting the texture data, but generating new geometry with UV coords.

2 Likes

Decals for 3D games would be great too if they were possible to make easy to use, like conforming to 3D geometry.

For 2D games, it’s common in other engines to allowing stamp/draw textures onto other textures for accumulative effects like blood as mentioned in the GameMaker references in original post.

1 Like

Yes, take for instance the game Deadbolt, which was built using GameMaker. I can’t know for certain, but it’s reasonable to assume the blood splatters (which accumulate) are drawn to a surface that matches the dimensions of the in-game wall.

Perhaps “decals” was the wrong word.

1 Like

This is what people used to making 3D games will think of when mentioning decals.

How to project decals - Wolfire Games Blog

1 Like