Add multiple post-shader support#6817
Conversation
This should also fix the performance issue of cycling the render target constantly somewhat. So the main issue internally is post-shaders stepping on each other's toes as they get rendered. To get around this we just use an intermediate that gets rendered into.
It's definitely not intended that entities like ghosts get their transparency multiplied for every post-shader so this fixes it. Separate PR as this will be more destructive on content and requires shader code inspection.
| _entityManager.EventBus.RaiseLocalEvent(entry.Uid, | ||
| new BeforePostShaderRenderEvent(entry.Sprite, viewport), | ||
| false); |
There was a problem hiding this comment.
Shouldn't this raise specific even for every post shader, passing their id, so that content can actually modify specific shader paramters based on it?
See #6719
There was a problem hiding this comment.
Or content can just... Access shaders form sprite comp? I guess its fine then
There was a problem hiding this comment.
Can do that.
| /// <summary> | ||
| /// A post-shader currently applied to this sprite. | ||
| /// </summary> | ||
| public sealed class PostShaderEntry |
|
please make this an api method like RenderSprite is or entity views in UI etc have no way to do post shaders without literally copy pasting everything from engine |
example!!! |
|
evil thing raidercode does for thermal vision "overlay" of shittiest hack known to man where it replaces the shader for every layer of a sprite (completely breaks dwarves btw) then calls RenderEntity and resets it |
|
see also this ai slop that will get broken by literally any layer with a shader because UseShader gets overriden in RenderSprite |
This should also fix the performance issue of cycling the render target constantly somewhat.
I also fixed post-shaders stacking their alpha so any transparent entities having it multiplied every time. The most obvious of this on content is ghost outlines messing with their transparency.
So the main issue internally is post-shaders stepping on each other's toes as they get rendered. To get around this we just use an intermediate that gets rendered into and swap between them.
Originally I had the 1 postrendertarget texture and drew a cutout of that but a bunch of content shaders assume they have exact bounds RN so changing that is more of a breaking change.
This should also stop the postshader churn where it recycles it every frame.