Decalery (aka Bakery Decals)

Decalery just releaed!

For a few years I was using a handy custom decal system. If you saw my game, you saw these decals pretty much everywhere. The concept is simple: just generate a mesh that follows the surface of an object, but clip it by the shape of the decal itself. Keep decal UV0 and vertex color (I’m using vertex alpha fading a lot), but project UV1 (lightmaps) and normals/tangents from the surface.

Because these decals are just meshes with a rather unsophisticated alpha-blended shader (with a little Z trick), they can be easily adapted to any render pipeline, platform or GAPI. You don’t need any GBuffer, you barely need any shaders at all to render them.

I saw similar solutions used in GTA 4/5. Why limit your decals to some deferred projective shapes, when you can just model them as literally any mesh? This way decals can be also used to neatly hide UV seams, speeding up modelling.
You can model any curved shape which doesn’t have to follow the receiving surface exactly, and then the script will align it to the surface. Decal can be a simple quad, or a specially cut shape, or even some wobbling ring around a cylinder.
Additionally, these decals support all Bakery features.

So the question is: YAY OR NAY? Should I polish and release it to the store? (I don’t think it should be expensive)

The only reason I didn’t do it before is because the resulting mesh is sometimes unoptimized. I need to add some vertex welding and decimation, but even in its current form I’m using it a lot.

It seems there are also existing mesh decal assets. I wonder if they already solve all these problems? Then maybe I’ll just keep this solution for myself :smile:

8654346--1164894--upload_2022-12-12_13-43-0.png

Here I’m applying curved road geometry as a decal, conformed to terrain:

Super old usage video (UI can be improved):

9 Likes

I’m really loving MonoSH in Bakery, and having a decal system that supports it would be amazing.

1 Like

release it please()wonder if i can use it on skinned meshes?

1 Like

Mega Yay!

2 Likes

There are, yes. The one I use is EasyDecal by Sycoforge Technologies, which can do exactly what yours does plus screen space and deferred, but I have only used it the way you do: generating static geometry and that’s it. (because performance matters)

However your system is the only one to account for the lightmap UVs, cut the mesh to the texture and support vertex alpha. Others just expect the decal to be applied by multiply or additive shaders, which is not ideal.

I’m definitively interested! :slight_smile:

One thing I miss from your screenshots though is an option to stretch the decal so it isn’t cut on 90º angles, like in the walls in this screenshot:

Other than that, I love it! :slight_smile:

1 Like

Not yet. But it should be possible to add.

They were stretched originally, but then you have these awful stretched lines which look kinda like a bug, so I decided to just clip polygons by angle instead…

That’s what I guessed. Then maybe just make it user configurable :stuck_out_tongue:

1 Like

Please do!

Projecting lightmap UVs is something I miss dearly in Unity.
It would be awesome also to allow non-deforming relatively flat meshes, e.g. Picture frames and the like to be used in the same way too
But even the decals would be a huge boon for forward-rendered games which have most things already lightmapped

1 Like

Definitely interested - forward needs better decal solutions!

There have been times where I’ve applied a normal map from an underlying material to my decal floater material + manually offset it to match; it felt so silly. Using tangent info from the directional map would be so much better.

Also, I despise placing edge decals so anything that aims to ease that is deeply appreciated.

1 Like

How do you imagine automating it? You don’t want to place them on EVERY sharp edge, right?
To me it’s a very case-by-case thing that I take care of during modelling.

It’s definitely case-by-case, yeah. I’m currently working on a project that’s forcing me to do it a bit so I may be biased in my loathing for it. I’m not sure if you’ve had a chance to check out the game Control at all, but their brutalist environment direction is a great example because it seemed like an overwhelming majority of their structural geo was primitives and base materials with almost every hard edge given an edge normal decal, haha.

I’m curious if a plausible method would be to do something similar to Unity’s LM unwrap where it looks at the angle of neighboring triangles (of tagged objects) + generates off some angle threshold of error? I’d also be happy if I could click on two verts + have it generate a strip across or something too. I’m not fully sure, but spitballin!

Sorry I’ve spent a month working on bakery. but it has more or less problems every time. I have no choice. Had to give it up to use the unity default pipeline for bakery. Is there any bakery tutorial that you would recommend for me to learn it systematically.

This thread is unrelated, but maybe

  1. My quickstart?
    https://geom.io/bakery/wiki/index.php?title=Manual#Quickstart

  2. Silent’s guide?
    https://gitlab.com/s-ilent/SCSS/-/wikis/Other/Light-Baking

  3. Just ask me questions for anything you can’t get right?

As for the decal system - how would this work with placing decals at runtime ? The only way I could see that properly supporting baked lighting is with meshless light baking (volumes or such), and I don’t think that that is currently possible with Bakery (would be absolutely awesome to see though).

No problem creating decals at runtime at all - just the same mesh generation/UV projection code. I did implement similar decals in the pre-Unity times, and it was pretty fast even on my 2009 machine.
(can be slow if projected on a very high-poly mesh though)

Oh that’s amazing ! Then this solution seems absolutely very promising - hope to see it sometime soon in the future !

Meshless lighting (light/irradiance volumes) are still Nr.1 on my Bakery wishlist though :slight_smile: Maybe some improvements to Bakery’s light volumes could get us there ?

1 Like

Would this work standalone without Bakery if we just need a simple mesh decal system?

Yeah, it definitely doesn’t have to be dependent on Bakery.

1 Like

Hi! Are there any updates on this? I could really use a system like this for current projects :slight_smile:

1 Like

Not yet, but will release the 1st version this year!

3 Likes