Apply shader to results of another shader?
Asked Answered
A

4

0

I have an image:

I have a shader that removes the Magenta color from the image causing it to look like this:

Now I want to take the results and add a green outline around the brown rectangle that is left. The desired end result should look like this:

I have the two shaders already, I just don't know how to use them together. I have read about multiple Viewports and the BackBufferCopy node, but don't fully understand if they would be helpful. Could someone please help me ?

Artair answered 7/12, 2021 at 14:45 Comment(0)
J
0

Why do you need two passes for this? You can do it in a single shader.

Jannet answered 9/12, 2021 at 9:36 Comment(0)
M
0

You can have multiple passes in a single shader. That is what next pass does. However, for something simple like this, it is easy to do it with one shader (you can do as much as you want to a single pixel). Also, don't bother with Viewports. Though they do work, the problem is that you have to copy the backbuffer from the GPU to the CPU and then back to the GPU, which is super expensive and negates any performance benefit of using a shader in the first place. Plus when you use Viewports, you can no longer select objects in the editor (seems like a major bug) which makes modifying and working on your game impossible.

Multifarious answered 9/12, 2021 at 19:25 Comment(0)
E
0

@cybereality said: You can have multiple passes in a single shader. That is what next pass does.

The Next Pass property is only supported in SpatialMaterial, not CanvasItemMaterial (despite it appearing there).

Supporting multi-pass shaders is planned in a future 4.x release, but not 4.0 due to time constraints.

Enure answered 9/12, 2021 at 22:22 Comment(0)
A
0

Thanks. That will be helpful

Artair answered 11/12, 2021 at 4:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.