I’m working with react-three-fiber, but this code directly relates to Three.js internals and an official example so I think it should fit this forum. Let me know if it doesn’t!
I’m attempting to apply a pixelation postprocessing effect to a specific layer in my game. After some trying I managed to apply the official PixelationEffect
.
I then found this example for a more complex pixelation pass and wanted to give it a go. Unfortunately despite the example’s code being quite similar to mine I’m having some issues.
I have a Codesandbox with my code here. With <SelectivePixelation toggle={false} />
It stops working with: TypeError: pass.setRenderer is not a function
.
Typescript does warn me in my IDE. renderPixelatedPass
:
I think this is some kind of versioning issue. The example in the repo seems to use its own Pass
(which I’ve replicated in the Codesandbox) which is different from the current Pass
exported by postprocessing
.
With <SelectivePixelation toggle={true} />
it uses Three’s internal PixelationEffect
which does work… But causes my layer 0 to always render on top:
Any idea how I can fix these issues?