gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Soft particles aren't visible in OpenMW

Open AbduSharif opened this issue 3 years ago • 7 comments

There's an on-going merge request for OpenMW to support soft particles, we have come across an issue on the Android port, the soft particles aren't visible.

Is blitting the depth buffer possible? The developer implementing the feature thinks that blitting might be the problem:

It might be, if the blit is essentially a no-op/unsupported that would give an empty depth sampler like you have currently.

But, they have a question which might help:

How can I copy the depth attachment of an FBO to a separate texture2D to sample from?

The MR: https://gitlab.com/OpenMW/openmw/-/merge_requests/980

AbduSharif avatar Oct 21 '21 22:10 AbduSharif

Adding ”highp” to this line in the soft particles shader didn't help:

uniform sampler2D opaqueDepthTex

AbduSharif avatar Oct 21 '21 22:10 AbduSharif

Most gles2 hardware don't allow depth buffer reading or writing. That may be the issue yes. It needs GLES3 for this to work, but gl4es doesn't support gles3 yet.

But depth textures should be supported, so not sure what's wrong. But drawing to a depth texture from an FBO, mmm, I'm unsure gles2 hardware support that.

ptitSeb avatar Oct 22 '21 05:10 ptitSeb

A little more info.

Attaching a texture to FBO depth and then later sampling from the texture works fine on their device. The issue here is that I need access to that depth texture while it's still bound to the active FBO (detaching temporarily won't be practical for some technical reasons). Even though I know I won't be writing to depth when I'm reading from it (depth writes are disabled), it is still undefined behavior in the spec to have the depth texture bound to a FBO and a texture unit at the same time. As a workaround I blit the depth attachment to a separate texture.

glassmancody avatar Oct 22 '21 06:10 glassmancody

Oh no, I already have seen games that does that, and the result realy depends on the hardware. gl4es tries to detect that case to mitigate, at least on Mali hardware, because it was just not working fine. What hardware are you using?

ptitSeb avatar Oct 22 '21 07:10 ptitSeb

As for hardware I'm using, unfortunately I am not much use as @AbduSharif is my tester for everything gl4es. I just try and fix any problems I cause for android port if I can.

Oh no, I already have seen games that does that, and the result realy depends on the hardware.

I was afraid of this.

glassmancody avatar Oct 22 '21 07:10 glassmancody

My GPU: Mali-G52 MC2

AbduSharif avatar Oct 22 '21 09:10 AbduSharif

Tried on a device with "Mali-G72 MP18" and it doesn't work there too.

AbduSharif avatar Oct 24 '21 18:10 AbduSharif