bkaradzic / bgfx

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
https://bkaradzic.github.io/bgfx/overview.html
BSD 2-Clause "Simplified" License
15.05k stars 1.94k forks source link

example-08-update: Scan through the LODs of the textures with shader. #3312

Closed mcourteaux closed 4 months ago

mcourteaux commented 4 months ago

I have not committed the binary shaders because when I rebuild them, literally all shaders gets modified, which is not on-topic for this PR, so I'll leave that to @bkaradzic.

I also updated the positions a little bit to reduce overlap:

image

So this PR uses time to loop through the different LODs.

image

This immediately reveals some issues:

Vulkan:

https://github.com/bkaradzic/bgfx/assets/845012/0403ab8c-7a92-411e-9286-9fb00144361a

OpenGL:

https://github.com/bkaradzic/bgfx/assets/845012/161c04a8-5a8a-4d1d-a903-3048feaa9930

ETC1 is flickering badly in deeper LODs.

bkaradzic commented 4 months ago

It looks like that flickering is coming from border color state...

bkaradzic commented 4 months ago

See here: https://github.com/bkaradzic/bgfx/blob/9547e798675330df5dacbed8a72feec012ff3ed5/examples/08-update/update.cpp#L275

ETC1 is just used to demonstrate sampler UV mode BORDER.

bkaradzic commented 4 months ago

Not a bug.

mcourteaux commented 4 months ago

Even if it's not a bug, it's crucial to assess whichever solution we come up with for #3311. My first-idea fix produces glitches for the smallest LODs. So being able to check what the LOD mipmap chain looks like for these compressed texture formats is important if we want to get it right and fix #3311.