Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PanoramaSky artifacts on Android/GLES2 #44489

Merged
merged 1 commit into from
Dec 20, 2020
Merged

Commits on Dec 20, 2020

  1. Fixes godotengine#43667.

    The root cause of the issue is that OpenGL ES 2 does not support the `textureCubeLod` function.
    There are (optional) extensions to support this, but they don't appear to be exposed with the ES2 renderer (even though the hardware needed to support LOD features are certainly available.)
    The existing shim in `drivers/gles2/shaders/cubemap_filter.glsl` just creates a macro:
    
    ```
     #define textureCubeLod(img, coord, lod) textureCube(img, coord)
    ```
    
    But the third parameter of `textureCube` is actually a mip bias, not an absolute mip level.
    (And it doesn't seem to work regardless.)
    In this specific case, the `cubemap_filter` should only sample from the first level of the "source" panorama cubemap.
    In lieu of a method to force a lod level of zero, I've chosen to comment out the switchover from a 2D equirectangular panorama to the cubemap version of the same image, therefore always sampling roughness values from the 2D equirectangular panorama.
    This may cause additional artifacts or issues across the seam, but at least it prevents the glaringly obvious black areas.
    
    ---
    
    This same issue (no fragment texture LOD support) has rather large repercussions elsewhere too; it means materials with larger cubemap density (i.e. planar or distant objects) will be far rougher than expected.
    Since GLES 3 appears to properly support fragment `texture*Lod` functions, switching to the GLES 3 backend would solve this problem.
    
    ---
    
    Root cause discovered with help from @kaadmy.
    ForestKatsch committed Dec 20, 2020
    Configuration menu
    Copy the full SHA
    8825aa8 View commit details
    Browse the repository at this point in the history