#How to apply post-processing to specific components (entities) without affecting others?

23 messages · Page 1 of 1 (latest)

alpine swift
#

If you want to be selective about post processing, I expect you'd want to use multiple cameras: render to texture with the post processing where you need it, then render those textures to the main camera.

warped lodge
alpine swift
#

I'd say it depends how much is going on in the scene. Can you provide a drawing or say a little about how many post processing setups you envision? Are the same post processor with different parameters? Does the post processor follow an entity? Or is it fixed to one area of the screen always?

warped lodge
warped lodge
#

What I want to implement is the filter effects from Adobe Animate, as shown in the image below. In Flash, a complex sprite is made up of many basic shapes. In Bevy, I use many Mesh2d to combine and render the sprite. I have already implemented Flash animation rendering, where each basic shape can have various filter effects, and each shape has different filter parameters, as shown in the image. I apologize for the image being in Chinese.

warped lodge
alpine swift
#

I see. Are you using your own material and shader or the Sprite component?

#

I can understand your hesitation at using multiple cameras for this. It could be A LOT of cameras. It seems to me that you'd want to try and do your post processing in your sprite material. Problem is Sprite does not have a custom material available. So you'd have to go back to Mesh2d or perhaps you're already doing that, are you?

#

Ok. **Another idea: **What if you take your post processing layer, and feed it your rectangles/areas of interest. Basically your sprites that require post processing. No rectangles, no post processing. That avoids having multiple cameras and custom shaders for every sprite. And you get compositing with what's on the screen, which custom sprite shaders wouldn't really be able to do.

warped lodge
warped lodge
alpine swift
#

Imagine we take the post processing shader and add a value horizontal from [0, 1]. With horizontal set to 0.5, the post processing effect only applies to the left side of the screen. On the right side, it passes through as if there were no post processing effect.

Now elaborate on that so you’ll have a list of regions where you’ll do the post processing effect. If no regions are given, no effect appears.

warped lodge
alpine swift
#

Woah. Very cool! Can you show where the effect would happen on 1 or 2 frames?

warped lodge
alpine swift
#

I see. So I suggested simple shapes but maybe it’d be more flexible if you had your post processing accept a texture as a mask. Then you could use one of the rgba channels for your post processing effect; you can have some gradations that way [0, 1]. You’d have to have a few extra cameras but a fixed number: post processing effect count / 4.

I’d suggest adding a sprite parented to the original that only draws to that camera on that one channel. Red for Glow, Green for Blur, etc.

warped lodge
alpine swift
#

How many post processing effects do you envision needing?

warped lodge
alpine swift
#

Cool. Then I’d suggest using two extra cameras to capture two textures that gives you eight channels. If instead you can do it with a bitmask—no gradations, then an R8 image would be sufficient with 1 camera.

warped lodge
#

Hmmm... After I check out the information, I have a feeling I won't be able to do this technique.ferris_sob

warped lodge
alpine swift
#

You’re welcome. Good luck!