MrSkinny

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.
MrSkinny
Posts: 11

Pharan

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.
User avatar
Pharan

Pharan
Posts: 5284

pascalkk

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.
EntityRender.png


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.
pascalkk
Posts: 11

MrSkinny

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.
MrSkinny
Posts: 11

ara

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 )
User avatar
ara
Posts: 28

pascalkk

@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
Posts: 11

ara

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.
User avatar
ara
Posts: 28

MrSkinny

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.
MrSkinny
Posts: 11

Pharan

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?
User avatar
Pharan

Pharan
Posts: 5284

MrSkinny

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.
MrSkinny
Posts: 11

Pharan

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

Pharan
Posts: 5284

Hannca

Thank you so much for your work looks really worthy, thanks for sharing
kind regards,Diceus
Hannca
Posts: 2

RemDust

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

pascalkk

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

:clap: :clap: :clap: :yes: :yes: :yes:
pascalkk
Posts: 11


Return to Unity