Stencil buffer set wrong in effectRenderer

Bug reproduce: https://playground.babylonjs.com/#K11VKJ#2.
Similar bug with Stencil buffer set wrong in highlightlayer excluded meshes after render.
EffectRenderer.restoreStates should be set to previous state rather than true directly.

Is it the right PG?

I don’t see any usage of the effect renderer(?)

However, you’re still right that we should reset the state to the previous value instead of setting true, I’m going to have a look at it.

Will be fixed by:

2 Likes

I’m not aware of how to write an effect renderer actually, so I created CopyTextureToTexture instead, I find it will use an effect renderer inside.
Edit: The playground only goes wrong after I enable the spector.js, I’m checking the differences.
Edit2: I made a mistake when using CopyTextureToTexture, this playground should show the bug: https://playground.babylonjs.com/#K11VKJ#3