Baking decals into a texture

Hi. I'm currently developing a top down 2d shooter in Unity that's mainly focused around decals (e.g splats, scorches etc). At the moment I'm using simple planes for each decal and, as you can imagine, a lot of them start to hinder performance (even when combined to one draw call).

Is the a method of baking them into the ground texture at any position using Texture2d.SetPixels and Texture2d.GetPixels?

Thanks.

If you are still having problems with this I came across a Unity Decal Framwork here:

(link removed)

Might be of use! Good luck :)

Edit: I added this link YEARS ago and it’s just come to my attention that the original website has since shut down and been replaced by a spyware/spam site so I have removed the link.

If you only need a limited number of decals per object you could potentially place them with additional texture inputs to a custom shader. Use a uv-transform (scale/offset) to place the decal on top of the base.

I once did a (non-Unity) demo project like this to make ants crawl across a face. Probably not the best solution (makes for expensive pixel shaders), but it's a neat technique.

There is a way to bake decals shadows (only shadows) into lightmap…

  1. Go to asset store and get “Simple Decals” (for free) and install it into your project
  2. open the scene contained on the package you just installed
  3. select one of the decals that are in scene, drag and drop it into the project folder (to create a prefab)
  4. return to your scene where you want to put decals in, drag the prefab you have created into sene and adjust it to fit
  5. mark the decal object as “static” on the property panel.
  6. reduce the decal´s material alpha value to 25% (so the baked decal won´t look so bold)
  7. bake scene …

Shadows are B/W not textured…
this is good to make a dirty implementation on the scene.