09-11-2023, 10:19 AM
(06-11-2023, 01:34 PM)josemendez Wrote: No, that's not why it happens. The cause has to do with how graphics works in general: transparent objects are rendered separately from opaque objects (after all opaque objects), and there's two kinds of transparent objects:It seems that the passthrough image texture is not available due to privacy reasons of the Quest. Would there be a way different way of doing it?
A) "regular" transparents (like the beakers) that perform no refraction: they show whatever is behind them undistorted. For these, just rendering them after all opaque objects and alpha blending them with the current contents framebuffer is enough.
B) refractive transparents (such as fluids) that distort whatever is behind them. These need to somehow arbitrarily sample the color of objects behind them at a position other than where they're being rendered, so regular alpha blending with the framebuffer contents doesn't work.
The way refractive objects distort what's behind them is by "saving" whatever it's currently rendered by the game camera up to that point into a texture, and then sampling and distorting the contents of that texture while rendering the transparent object. However when using passtrough, the game camera is not rendering anything in the passtrough areas but a black background, so the texture sampled by the fluid renderer is black. The input of the physical cameras in the headset is stored in a different texture, that the fluid renderer knows nothing about.
You need to write a custom shader that samples the texture where the passtrough image captured by the physical camera is stored, instead of the texture that contains what the game camera is rendering. You can use the included FluidShader (Obi/Resources/ObiMaterials/FluidShader.shader) as a starting point for this.
kind regards,