expenses / mateversum

Mateversum is a peer-to-peer WebXR metaverse project. Binary: https://github.com/expenses/mateversum-web
https://expenses.github.io/mateversum-web
MIT License
24 stars 1 forks source link

Framebuffer perf improvements #28

Closed expenses closed 2 years ago

expenses commented 2 years ago

Mateversum currently isnt too performant on mobile GPUs such as the Oculus quest 2 and OnePlus Nord (my phone).

A decent amount of this can be attributed to the sampling cost of the cubemaps (can be mitigated by reducting them down to 512x512).

Another source is that we're rendering to a fp16 hdr framebuffer even if we're just immediately tonemapping it. Doing this is useful because it gives us a place to insert effects like bloom, but that's only really viable for discrete GPUs. So we should do the following:

This also gives us the advantage of having a better AR mode, as we would be able to render ontop of the camera view again!

expenses commented 2 years ago

Low perf GPUs when doing multiview AR (such as the hololens):

Clear multiview framebuffer to transparent, render, then blit in a texture to make sure we're doing alpha blending.

expenses commented 2 years ago

Implemented to some degree in https://github.com/expenses/mateversum/tree/better-framebuffer-perf-stuff. hololens stuff should work fine.

on low perf GPUs when doing VR, tonemap in fragment shaders to the multiview framebuffer, then copy that over to the device framebuffer.

Turns out we cant do normal framebuffer blits as a speed-up, because https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/blitFramebuffer doesn't let you set the array layer to use 🙃

expenses commented 2 years ago

Okay, I merged that branch. I don't think I can really improve framebuffer performance from its current state.