How to change prepass renderer texture sampling mode

I was making a custom postprocess and stored some value in the prepass textures. But as they are linear, I failed to get the value pixel by pixel.
This is what I’ve tried: I tried to use updateCount but it failed, the depth channel’s texture is nearest when debug but it remains bilinear when I use Spector to see the result.

And I also tried to hack PrePassRenderer._enable and passed an extra samplingModes when updateCount was called, but it not work either.

So I was wondering if it is possible to change the sampling mode of some channels, for example only depth channel in the playground?

And, Happy Christmas!

The textures you create by calling updateCount are recreated later by the prepass renderer, so your changes will be overwritten. Instead, you can do it like this:

1 Like

The resolution do work but it seems msaa also caused value to mix with near pixels, I’ll try to find if there is a way to disable msaa for depth channel only. Thank you all the same!

Unfortunately it’s not possible, MSAA is a global setting for all the textures of the MRT, you can’t have it at the texture level (it’s a limitation of the underlying native APIs). If you don’t want MSAA for the depth, you will have to disable it and use another AA method for the color texture (like FXAA).

So costing one time draw call to render a RTT to store the value is the only way for me. :dizzy_face: