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:
parent
cc8a717a81
commit
2960ad845c
2 changed files with 7 additions and 4 deletions
libraries/render-utils/src
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue