Revert "Fixing the rendering bug triggered with Nvidia driver 381.65"

This commit is contained in:
samcake 2017-04-07 02:03:31 -07:00 committed by GitHub
parent ac9b181786
commit ab3d39951e
7 changed files with 16 additions and 36 deletions

View file

@ -88,9 +88,8 @@ static const std::string DEFAULT_NORMAL_SHADER {
static const std::string DEFAULT_OCCLUSION_SHADER{
"vec4 getFragmentColor() {"
// " DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
// " return vec4(vec3(pow(frag.obscurance, 1.0 / 2.2)), 1.0);"
" return vec4(vec3(pow(texture(specularMap, uv).a, 1.0 / 2.2)), 1.0);"
" DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
" return vec4(vec3(pow(frag.obscurance, 1.0 / 2.2)), 1.0);"
" }"
};
@ -195,18 +194,6 @@ static const std::string DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER{
" }"
};
static const std::string DEFAULT_CURVATURE_OCCLUSION_SHADER{
"vec4 getFragmentColor() {"
" vec4 midNormalCurvature;"
" vec4 lowNormalCurvature;"
" unpackMidLowNormalCurvature(uv, midNormalCurvature, lowNormalCurvature);"
" float ambientOcclusion = curvatureAO(lowNormalCurvature.a * 20.0f) * 0.5f;"
" float ambientOcclusionHF = curvatureAO(midNormalCurvature.a * 8.0f) * 0.5f;"
" ambientOcclusion = min(ambientOcclusion, ambientOcclusionHF);"
" return vec4(vec3(ambientOcclusion), 1.0);"
" }"
};
static const std::string DEFAULT_DEBUG_SCATTERING_SHADER{
"vec4 getFragmentColor() {"
" return vec4(pow(vec3(texture(scatteringMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
@ -216,7 +203,7 @@ static const std::string DEFAULT_DEBUG_SCATTERING_SHADER{
static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
"vec4 getFragmentColor() {"
" return vec4(vec3(texture(obscuranceMap, uv).x), 1.0);"
" return vec4(vec3(texture(obscuranceMap, uv).xyz), 1.0);"
// When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);"
// when drawing normal" return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);"
" }"
@ -301,8 +288,6 @@ std::string DebugDeferredBuffer::getShaderSourceCode(Mode mode, std::string cust
return DEFAULT_DIFFUSED_CURVATURE_SHADER;
case DiffusedNormalCurvatureMode:
return DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER;
case CurvatureOcclusionMode:
return DEFAULT_CURVATURE_OCCLUSION_SHADER;
case ScatteringDebugMode:
return DEFAULT_DEBUG_SCATTERING_SHADER;
case AmbientOcclusionMode:

View file

@ -72,7 +72,6 @@ protected:
NormalCurvatureMode,
DiffusedCurvatureMode,
DiffusedNormalCurvatureMode,
CurvatureOcclusionMode,
ScatteringDebugMode,
AmbientOcclusionMode,
AmbientOcclusionBlurredMode,

View file

@ -67,8 +67,10 @@ DeferredFragment unpackDeferredFragmentNoPosition(vec2 texcoord) {
frag.scattering = 0.0;
unpackModeMetallic(diffuseVal.w, frag.mode, frag.metallic);
//frag.emissive = specularVal.xyz;
frag.obscurance = min(specularVal.w, frag.obscurance);
if (frag.mode == FRAG_MODE_SCATTERING) {
frag.scattering = specularVal.x;
}

View file

@ -55,7 +55,7 @@ void DeferredFramebuffer::allocate() {
_deferredColorTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(colorFormat, width, height, gpu::Texture::SINGLE_MIP, defaultSampler));
_deferredNormalTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(linearFormat, width, height, gpu::Texture::SINGLE_MIP, defaultSampler));
_deferredSpecularTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(linearFormat, width, height, gpu::Texture::SINGLE_MIP, defaultSampler));
_deferredSpecularTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(colorFormat, width, height, gpu::Texture::SINGLE_MIP, defaultSampler));
_deferredFramebuffer->setRenderBuffer(0, _deferredColorTexture);
_deferredFramebuffer->setRenderBuffer(1, _deferredNormalTexture);

View file

@ -62,7 +62,7 @@ vec3 evalAmbientSpecularIrradiance(LightAmbient ambient, vec3 fragEyeDir, vec3 f
<@if supportScattering@>
float curvatureAO(in float k) {
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369f;
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369;
}
<@endif@>
@ -83,13 +83,14 @@ void evalLightingAmbient(out vec3 diffuse, out vec3 specular, LightAmbient ambie
specular = evalAmbientSpecularIrradiance(ambient, eyeDir, normal, roughness) * ambientFresnel;
<@if supportScattering@>
if (scattering * isScatteringEnabled() > 0.0) {
float ambientOcclusion = curvatureAO(lowNormalCurvature.w * 20.0f) * 0.5f;
float ambientOcclusionHF = curvatureAO(midNormalCurvature.w * 8.0f) * 0.5f;
ambientOcclusion = min(ambientOcclusion, ambientOcclusionHF);
obscurance = min(obscurance, ambientOcclusion);
if (scattering * isScatteringEnabled() > 0.0) {
// Diffuse from ambient
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;

View file

@ -16,20 +16,15 @@
<@include gpu/Color.slh@>
<$declareColorWheel()$>
uniform sampler2D linearDepthMap;
uniform sampler2D halfLinearDepthMap;
uniform sampler2D halfNormalMap;
uniform sampler2D occlusionMap;
uniform sampler2D occlusionBlurredMap;
uniform sampler2D curvatureMap;
uniform sampler2D diffusedCurvatureMap;
uniform sampler2D scatteringMap;
<$declareDeferredCurvature()$>
float curvatureAO(float k) {
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369f;
}
in vec2 uv;
out vec4 outFragColor;

View file

@ -63,8 +63,7 @@ Column {
"Directional:LightingModel:enableDirectionalLight",
"Point:LightingModel:enablePointLight",
"Spot:LightingModel:enableSpotLight",
"Light Contour:LightingModel:showLightContour",
"Shadow:RenderShadowTask:enabled"
"Light Contour:LightingModel:showLightContour"
]
CheckBox {
text: modelData.split(":")[0]
@ -151,7 +150,6 @@ Column {
ListElement { text: "Mid Normal"; color: "White" }
ListElement { text: "Low Curvature"; color: "White" }
ListElement { text: "Low Normal"; color: "White" }
ListElement { text: "Curvature Occlusion"; color: "White" }
ListElement { text: "Debug Scattering"; color: "White" }
ListElement { text: "Ambient Occlusion"; color: "White" }
ListElement { text: "Ambient Occlusion Blurred"; color: "White" }