mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 18:15:26 +02:00
Revert "Fixing the rendering bug triggered with Nvidia driver 381.65"
This commit is contained in:
parent
ac9b181786
commit
ab3d39951e
7 changed files with 16 additions and 36 deletions
|
@ -88,9 +88,8 @@ static const std::string DEFAULT_NORMAL_SHADER {
|
||||||
|
|
||||||
static const std::string DEFAULT_OCCLUSION_SHADER{
|
static const std::string DEFAULT_OCCLUSION_SHADER{
|
||||||
"vec4 getFragmentColor() {"
|
"vec4 getFragmentColor() {"
|
||||||
// " DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
|
" DeferredFragment frag = unpackDeferredFragmentNoPosition(uv);"
|
||||||
// " return vec4(vec3(pow(frag.obscurance, 1.0 / 2.2)), 1.0);"
|
" 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);"
|
|
||||||
" }"
|
" }"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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{
|
static const std::string DEFAULT_DEBUG_SCATTERING_SHADER{
|
||||||
"vec4 getFragmentColor() {"
|
"vec4 getFragmentColor() {"
|
||||||
" return vec4(pow(vec3(texture(scatteringMap, uv).xyz), vec3(1.0 / 2.2)), 1.0);"
|
" 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{
|
static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
|
||||||
"vec4 getFragmentColor() {"
|
"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 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);"
|
// 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;
|
return DEFAULT_DIFFUSED_CURVATURE_SHADER;
|
||||||
case DiffusedNormalCurvatureMode:
|
case DiffusedNormalCurvatureMode:
|
||||||
return DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER;
|
return DEFAULT_DIFFUSED_NORMAL_CURVATURE_SHADER;
|
||||||
case CurvatureOcclusionMode:
|
|
||||||
return DEFAULT_CURVATURE_OCCLUSION_SHADER;
|
|
||||||
case ScatteringDebugMode:
|
case ScatteringDebugMode:
|
||||||
return DEFAULT_DEBUG_SCATTERING_SHADER;
|
return DEFAULT_DEBUG_SCATTERING_SHADER;
|
||||||
case AmbientOcclusionMode:
|
case AmbientOcclusionMode:
|
||||||
|
|
|
@ -72,7 +72,6 @@ protected:
|
||||||
NormalCurvatureMode,
|
NormalCurvatureMode,
|
||||||
DiffusedCurvatureMode,
|
DiffusedCurvatureMode,
|
||||||
DiffusedNormalCurvatureMode,
|
DiffusedNormalCurvatureMode,
|
||||||
CurvatureOcclusionMode,
|
|
||||||
ScatteringDebugMode,
|
ScatteringDebugMode,
|
||||||
AmbientOcclusionMode,
|
AmbientOcclusionMode,
|
||||||
AmbientOcclusionBlurredMode,
|
AmbientOcclusionBlurredMode,
|
||||||
|
|
|
@ -67,8 +67,10 @@ DeferredFragment unpackDeferredFragmentNoPosition(vec2 texcoord) {
|
||||||
frag.scattering = 0.0;
|
frag.scattering = 0.0;
|
||||||
unpackModeMetallic(diffuseVal.w, frag.mode, frag.metallic);
|
unpackModeMetallic(diffuseVal.w, frag.mode, frag.metallic);
|
||||||
|
|
||||||
|
//frag.emissive = specularVal.xyz;
|
||||||
frag.obscurance = min(specularVal.w, frag.obscurance);
|
frag.obscurance = min(specularVal.w, frag.obscurance);
|
||||||
|
|
||||||
|
|
||||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||||
frag.scattering = specularVal.x;
|
frag.scattering = specularVal.x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ void DeferredFramebuffer::allocate() {
|
||||||
|
|
||||||
_deferredColorTexture = gpu::TexturePointer(gpu::Texture::createRenderBuffer(colorFormat, width, height, gpu::Texture::SINGLE_MIP, defaultSampler));
|
_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));
|
_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(0, _deferredColorTexture);
|
||||||
_deferredFramebuffer->setRenderBuffer(1, _deferredNormalTexture);
|
_deferredFramebuffer->setRenderBuffer(1, _deferredNormalTexture);
|
||||||
|
|
|
@ -62,7 +62,7 @@ vec3 evalAmbientSpecularIrradiance(LightAmbient ambient, vec3 fragEyeDir, vec3 f
|
||||||
|
|
||||||
<@if supportScattering@>
|
<@if supportScattering@>
|
||||||
float curvatureAO(in float k) {
|
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@>
|
<@endif@>
|
||||||
|
|
||||||
|
@ -83,12 +83,13 @@ void evalLightingAmbient(out vec3 diffuse, out vec3 specular, LightAmbient ambie
|
||||||
specular = evalAmbientSpecularIrradiance(ambient, eyeDir, normal, roughness) * ambientFresnel;
|
specular = evalAmbientSpecularIrradiance(ambient, eyeDir, normal, roughness) * ambientFresnel;
|
||||||
|
|
||||||
<@if supportScattering@>
|
<@if supportScattering@>
|
||||||
if (scattering * isScatteringEnabled() > 0.0) {
|
float ambientOcclusion = curvatureAO(lowNormalCurvature.w * 20.0f) * 0.5f;
|
||||||
float ambientOcclusion = curvatureAO(lowNormalCurvature.w * 20.0f) * 0.5f;
|
float ambientOcclusionHF = curvatureAO(midNormalCurvature.w * 8.0f) * 0.5f;
|
||||||
float ambientOcclusionHF = curvatureAO(midNormalCurvature.w * 8.0f) * 0.5f;
|
ambientOcclusion = min(ambientOcclusion, ambientOcclusionHF);
|
||||||
ambientOcclusion = min(ambientOcclusion, ambientOcclusionHF);
|
|
||||||
|
|
||||||
obscurance = min(obscurance, ambientOcclusion);
|
obscurance = min(obscurance, ambientOcclusion);
|
||||||
|
|
||||||
|
if (scattering * isScatteringEnabled() > 0.0) {
|
||||||
|
|
||||||
// Diffuse from ambient
|
// Diffuse from ambient
|
||||||
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
||||||
|
|
|
@ -16,20 +16,15 @@
|
||||||
<@include gpu/Color.slh@>
|
<@include gpu/Color.slh@>
|
||||||
<$declareColorWheel()$>
|
<$declareColorWheel()$>
|
||||||
|
|
||||||
|
|
||||||
uniform sampler2D linearDepthMap;
|
uniform sampler2D linearDepthMap;
|
||||||
uniform sampler2D halfLinearDepthMap;
|
uniform sampler2D halfLinearDepthMap;
|
||||||
uniform sampler2D halfNormalMap;
|
uniform sampler2D halfNormalMap;
|
||||||
uniform sampler2D occlusionMap;
|
uniform sampler2D occlusionMap;
|
||||||
uniform sampler2D occlusionBlurredMap;
|
uniform sampler2D occlusionBlurredMap;
|
||||||
|
uniform sampler2D curvatureMap;
|
||||||
|
uniform sampler2D diffusedCurvatureMap;
|
||||||
uniform sampler2D scatteringMap;
|
uniform sampler2D scatteringMap;
|
||||||
|
|
||||||
<$declareDeferredCurvature()$>
|
|
||||||
|
|
||||||
float curvatureAO(float k) {
|
|
||||||
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369f;
|
|
||||||
}
|
|
||||||
|
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 outFragColor;
|
out vec4 outFragColor;
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,7 @@ Column {
|
||||||
"Directional:LightingModel:enableDirectionalLight",
|
"Directional:LightingModel:enableDirectionalLight",
|
||||||
"Point:LightingModel:enablePointLight",
|
"Point:LightingModel:enablePointLight",
|
||||||
"Spot:LightingModel:enableSpotLight",
|
"Spot:LightingModel:enableSpotLight",
|
||||||
"Light Contour:LightingModel:showLightContour",
|
"Light Contour:LightingModel:showLightContour"
|
||||||
"Shadow:RenderShadowTask:enabled"
|
|
||||||
]
|
]
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: modelData.split(":")[0]
|
text: modelData.split(":")[0]
|
||||||
|
@ -151,7 +150,6 @@ Column {
|
||||||
ListElement { text: "Mid Normal"; color: "White" }
|
ListElement { text: "Mid Normal"; color: "White" }
|
||||||
ListElement { text: "Low Curvature"; color: "White" }
|
ListElement { text: "Low Curvature"; color: "White" }
|
||||||
ListElement { text: "Low Normal"; color: "White" }
|
ListElement { text: "Low Normal"; color: "White" }
|
||||||
ListElement { text: "Curvature Occlusion"; color: "White" }
|
|
||||||
ListElement { text: "Debug Scattering"; color: "White" }
|
ListElement { text: "Debug Scattering"; color: "White" }
|
||||||
ListElement { text: "Ambient Occlusion"; color: "White" }
|
ListElement { text: "Ambient Occlusion"; color: "White" }
|
||||||
ListElement { text: "Ambient Occlusion Blurred"; color: "White" }
|
ListElement { text: "Ambient Occlusion Blurred"; color: "White" }
|
||||||
|
|
Loading…
Reference in a new issue