textureCube mips artifacts

  1. I’m looking into PBRLitSolid.glsl and can’t figure out how it changes the blurriness of Cubemap texture on materials with different roughness. I thought, it should select a particular mip level, but according to shader code it does not:

finalColor += cMatEnvMapColor * textureCube(sEnvCubeMap, reflect(vReflectionVec, normal)).rgb;

  1. I’m getting artifacts while trying to draw blurred cubemap. In deferred lighting mode I have a quad pass which reads normal and draws sky reflections into framebuffer.

vec3 reflcol = textureCube(sEnvCubeMap,normal,16.).rgb;

What I’m getting looks like biggest MIP is leaking:

        #ifdef ENVCUBEMAP
            finalColor += cMatEnvMapColor * textureCube(sEnvCubeMap, reflect(vReflectionVec, normal)).rgb;
        #endif

It has no direct relationship to the PBR (just identical part from default shaders, rudiment).

You need ImageBasedLighting() function

1 Like

May be in texture only 10 miplevels?

Thank you for pointing me in the right direction! In IBL.glsl it’s textureLod not textureCube, and textureLod works perfectly.

May be in texture only 10 miplevels?

Actually 8 :), and artifacts are visible on all of them, I just slapped higher number to make it more visible.