Applying shader to image on the foreground


#1

I’m trying to reverse this example. In this example a shader is applied to a background image, while the foreground image is not affected.

However when I try to do the opposite, that is apply the shader to the front one and ignore the back one, the back image is not visible anymore.

I tried it by modifying the following line:
this.cameras.main.setRenderToTexture(customPipeline);

Into:
extracam.setRenderToTexture(customPipeline);

More generally, I’m interested in being able to selectively apply shaders to specific images on the scene; reversing the current example is a first step in that direction.


#2

You can apply the shader to the hotdog with
hotdog.setPipeline('Custom');
but the shader also adds a black background to the hotdog image, so the shader needs to be modified for your purpose if I understand you correctly.


#3

Thanks, that’s what I needed. The added black background could be an issue in some situations but for my use case it isn’t! :slight_smile: