3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 09:15:25 +02:00

Fixed weird rendering bug.

This commit is contained in:
Olivier Prat 2018-01-10 10:55:45 +01:00
parent cc8a717a81
commit 2960ad845c
2 changed files with 7 additions and 4 deletions
libraries/render-utils/src

View file

@ -16,7 +16,7 @@ uniform samplerCube skyboxMap;
vec4 evalSkyboxLight(vec3 direction, float lod) {
// textureQueryLevels is not available until #430, so we require explicit lod
// float mipmapLevel = lod * textureQueryLevels(skyboxMap);
float filterLod = textureQueryLod(skyboxMap, direction);
float filterLod = textureQueryLod(skyboxMap, direction).x;
// Keep texture filtering LOD as limit to prevent aliasing on specular reflection
lod = max(lod, filterLod);
return textureLod(skyboxMap, direction, lod);

View file

@ -133,16 +133,19 @@ SurfaceData initSurfaceData(float roughness, vec3 normal, vec3 eyeDir) {
SurfaceData surface;
surface.eyeDir = eyeDir;
surface.normal = normal;
surface.lightDir = vec3(0,0,0);
surface.halfDir = vec3(0,0,0);
surface.roughness = mix(0.001, 1.0, roughness);
surface.roughness2 = surface.roughness * surface.roughness;
surface.roughness4 = surface.roughness2 * surface.roughness2;
surface.ndotv = clamp(dot(normal, eyeDir), 0.0, 1.0);
surface.smithInvG1NdotV = evalSmithInvG1(surface.roughness4, surface.ndotv);
// These values will be set when we know the light direction, in updateSurfaceDataWithLight
surface.ndoth = 0.0;
surface.ndotl = 0.0;
surface.ldoth = 0.0;
surface.smithInvG1NdotV = evalSmithInvG1(surface.roughness4, surface.ndotv);
surface.lightDir = vec3(0,0,1);
surface.halfDir = vec3(0,0,1);
return surface;
}