When highlighted mesh is behind, or partially behind a transparent mesh,
the part which is behind the transparent mesh is filled with the HL color.
In this case you should exclude the transparent plane from the highlight layer:
It has always worked until 4.2.0, without having to do that
Indeed, but there was a change in 4.2 in the stencil buffer handling that led to this change. I guess we should make it clearer in the āBreaking changesā section that it can affect the highlight layer, as for the time being it reads:
- Rendering of transparent meshes: stencil state is now set to the value
registered in the engine instead of being set to `false` unconditionally
That should make it clearer:
- Rendering of transparent meshes: stencil state is now set to the value
registered in the engine instead of being set to `false` unconditionally.
This change may affect the highlight layer when using transparent meshes.
If you are impacted, you may need to exclude the transparent mesh(es) from the layer
Iām not sure i fully understand,
to the value registered in the engine
but using Highlight layer,
the engine is created with stencil: true, so why would this be affected if itās supposed to follow the engines settings?
The value registered with the engine is the one set when calling engine.setStencilBuffer(value)
. Will make it clear in the comment.
The value you pass to the engine when you create it is just a way to say you may use the stencil buffer in the future, but it is still disabled at start until you call engine.setStencilBuffer(true)
at some point.
If you donāt want to exclude your mesh from the layer, you can do what the engine did before the correction, namely set the stencil buffer to false before drawing the transparent meshes: