Automatically detect mipmap count for IBL;

This commit is contained in:
bjorn 2019-08-07 15:56:52 -07:00
parent b5be93b94b
commit 2c115ce66e
1 changed files with 2 additions and 1 deletions

View File

@ -242,7 +242,8 @@ const char* lovrStandardFragmentShader = ""
// Indirect lighting
"#ifdef FLAG_indirectLighting \n"
" vec2 lookup = texture(lovrBRDFLookup, vec2(NoV, roughness)).rg; \n"
" vec3 specularIndirect = (F0 * lookup.r + lookup.g) * textureLod(lovrSpecularIrradianceTexture, R, roughness * 1.).rgb; \n"
" float mipmaps = log2(textureSize(lovrSpecularIrradianceTexture, 0).x); \n"
" vec3 specularIndirect = (F0 * lookup.r + lookup.g) * textureLod(lovrSpecularIrradianceTexture, R, roughness * mipmaps).rgb; \n"
" vec3 diffuseIndirect = diffuseDirect * E_SphericalHarmonics(lovrIrradiance, N); \n"
"#ifdef FLAG_occlusion \n" // Occlusion only affects indirect diffuse light
" diffuseIndirect *= texture(lovrOcclusionTexture, uv).r; \n"