• Unity
  • Tool for outlines, dissolves, transparency

I created a tool that automates the setup and management of a multi-camera -> render texture system for our game. We did this so that we could have apply effects like transparency, dissolves, and outlines to our Spine assets. It worked so well for us that I extracted the code out into a standalone package.

Source: https://github.com/aflesher/EntityPostProcessor2D
Package: https://drive.google.com/open?id=1-eA-qDG59Q6EsTLXh0prcmobsTHtuyp5

There are a few drawbacks to this system. There is some performance overhead because you are adding an extra draw call for every asset you want to use this tool on. You also won't be able to use this with environmental lighting. This is because the assets are placed off screen and rendered back onto a texture on screen. I've been trying to come up with a solution for this but haven't yet.

Anyways, it's free to use so enjoy. If people actually find this useful I'll add some better effects. The ones I included were really just the bare minimum to demonstrate how it works.

Related Discussions
...

Thanks for sharing! I'm sure this will be useful for many people!
I think the people who were looking for 2DxFX (or similar packages) compatibility may be able to use this.

What's cool is that this would work for plain Unity-animated and 3D animated stuff too.

I think "entity" in the name may confuse some people who are familiar with the "entity-component-system" paradigm.
To those people: this doesn't have much to do with that.

4 days later

thanks for your share, this is a good tool!

I got the example and run it correctly,the effect is cool.

and I got this EntityRenderOutput is base on MeshRenderer and MeshFilter.

is there any way to make the EntityRenderOutput base on SpriteRenderer?
so that i cant use 2Dxfx on it,just like @Pharan said.

thanks your tool again,it guide me a correct way to use more effect.

4 days later

I'll look into this, I see that rendering to a SpriteRenderer could be useful.

Unfortunately, I don't have the 2dxfx package but I have a feeling it could easily work with a camera or mesh renderer/quad.

Anyways, I'll respond to this once I have an update.


I took a look at compatibility with 2DxFX. I more or less got it working. You'll need to download a newer version of the tool which you can get from the links in the original post.

There are details at the bottom of https://github.com/aflesher/EntityPostProcessor2D on how to get this working. I tried about 5 different effects and they all worked after doing a search and replace for SpriteRenderer/MeshRenderer. It's not a perfect solution but hopefully it helps.

Thanks for sharing this amazing tool!
One thing I'm not sure did you translate spinegameobject to Sprites?
when I using spine SkeletonAnimation it doesn't work ( I can see the output but nothing change with EntityEffects on prefab )

@MrSKiny
Thank you very much for your work,and I got some problem with it。I submit a issue on github,hope noticed and I'm trying study it.
Thanks again!

@ara it not transate spinegameobject to Sprites~

pascalkk wrote

@MrSKiny
Thank you very much for your work,and I got some problem with it。I submit a issue on github,hope noticed and I'm trying study it.
Thanks again!

@ara it not transate spinegameobject to Sprites~

thank you for telling me that

I just can't apply Effects on EntityPostProcessor prefab.

There were a few issues with this tool that have been resolved. Download the newest package and these issues should be resolved.

Also, I created a video to demonstrate how to setup Spine + 2DxFx. Hope this adds some clarity.

Thanks, Mr Skinny! That's really helpful. I think seeing the GameObject setup really clarifies how the different components fit. Seeing the steps is super handy too.

Are there particular features in MeshRenderer that made you choose that type instead of SpriteRenderer?

That's a great question Pharan. I actually set out to see if it was possible to render to a SpriteRenderer instead of MeshRenderer but it's not really feasible.

The issue is that a SpriteRenderer requires a Texture2D but a camera, when rendered to a texture, creates a RenderTexture. Converting a RenderTexture to a Texture2D is a pretty heavy operation and only supported by graphics cards that have copyTexture https://docs.unity3d.com/ScriptReference/Rendering.CopyTextureSupport.html

That's not to say that I couldn't add the option to render to a SpriteRenderer. But it would need warning information stating that this is a really inefficient approach and should be avoided if possible. I think anyone that is serious about the performance of their game would be wise to try and modify any effects to work with a MeshRenderer instead.

Ah, that makes sense.
SpriteRenderer seems like it would've been a poor option.

5 days later

Thank you so much for sharing this, seems really nit :yes:

13 days later

@[deleted]
Thanks for your enthusiastic,great work and intuitively video tutorial!
It help a lot。
I learn so much。

:clap: :clap: :clap: :yes: :yes: :yes:

5 months later

@[deleted]

First of all, THANK YOU!

Doubt: I'm looking forward to buy 2DxFX (and use spine obviously), is it "that" simple? just replace SpriteRenderer for MeshRenderer? I mean, while 2DxFX scripts does not add a specific SpriteRenderer methods/properties it works perfect, but does anyone know if there's an effect that does not work just replacing it? (maybe all effects work the same way and I'm just confusing this thread bit more)

Sorry to add more work to you in this thread! Thanks for your attention!

5 days later

Thank u so much man 🙂

I'd also be interested to know if you guys had complications going further with 2Dfx 😉