Question about AlphaMode

  1. I add a holographic effect in PG, AlphaMode is Add, I have some troubles that when alpha <0.01 or other value, line will be discard, when alpha increase gl_FragColor is from none to correct color to pink to white. Why line be discard? Why blend color is pink in progress.
    https://playground.babylonjs.com/#W6EUYR#22

  2. I use two effectWrappers to update two ping-pong rtts, could babylonjs render effectWrappers with multi-input-rtts and multi-output-rtts?

Regarding 1/, the output canvas is 8 bits, and you don’t have enough precision to see anything when the alpha is < 0.01. You can force all rendering to be done in floating point by creating a pass post-process like this:

const pass = new BABYLON.PassPostProcess("pass", 1, camera, undefined, undefined, undefined, BABYLON.Constants.TEXTURETYPE_FLOAT);

(TEXTURETYPE_HALF_FLOAT also works and consumes half the memory)

The conversion to 8 bits is only performed at the end, so you will be able to see the XRay even below 0.01:

Regarding 2/, effectRenderer is meant to be simple and efficient and can only render to a single RTT. You should use a MultiRenderTarget if you want to be able to render to multiple textures at once.

2 Likes

Thank you for your help! I will try how to use multiRenderTarget :laughing: