Closed allcreater closed 9 months ago
Separately, I would like notice GLES 3, the reference of which (F.2 DIFFERENCES IN RUNTIME BEHAVIOR) it is said:
OpenGL ES 3.0 requires that all cubemap filtering be seamless
that is, the fix should only affect GLES33, not GLES3 :)
Thanks for the report! Yeah, I actually remember that I read about the cross-face sampling stuff recently when I wrote a new cubemap sample (currently still in the webgpu branch):
https://floooh.github.io/sokol-webgpu/cubemap-jpeg-sapp.html
...but I didn't notice seams neither in WebGPU nor in WebGL2, so I didn't pursue this further.
For GL we should definitely enable this GL_TEXTURE_CUBE_MAP_SEAMLESS state, for D3D11 and Metal I need to investigate whether it's on by default or needs to be activated.
Right, there are the seams (native GL version on macOS):
Since that sample is on the sgfx-wgpu branch I guess it makes sense when I fix it there. The merge won't be too far off.
Yep, enabling GL_TEXTURE_CUBE_MAP_SEAMLESS
fixes the issue for desktop GL. I'll still need to check D3D11 and Metal though, I'll keep the issue open until then.
(and as I said above, the fixes go into the sgfx-wgpu
branch for now)
...not seeing any seams in Metal... and googling around it appears that in D3D11 it's also always enabled, but I'll verify.
Ok just checked the cubemap sample on D3D11 and that looks good too, so desktop GL is the only backend which requires a fix.
I'm closing the ticket since the fix has been implemented in the sgfx-wgpu branch (no safe ETA yet though when this will be merged into main though, but "any week now").
If you can't wait that long I can also cherry-pick the fix into master.
Hi, I discovered a small flaw in the GLCORE33 backend for sokol_gfx (unfortunately, the version is ~out~dated 02/20/2023)
Filtering mipmapped cubemaps works differently for GLCORE33 and GLES3 (as well as METAL, but I haven't tested D3D and WebGPU) - in the first case they have very distinguishable seams due to the limitation of sampling only to the current face, the expected(and seems default in modern graphic APIs) behavior is smoothed.
It seems that to achieve similar behavior under OpenGL 3.3 it is enough to enable just one state:
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
I apologize for reporting the old version's bug, but I didn’t find the inclusion of the above-described state in the current code base and I suspect that using sampler objects should not make fix the issue on their own