mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 14:03:17 +02:00
Introducing a fix to the graphics bug
This commit is contained in:
parent
da1355dc32
commit
b1a4bc329b
4 changed files with 25 additions and 29 deletions
|
@ -85,30 +85,14 @@ static const std::string DEFAULT_NORMAL_SHADER {
|
|||
" return vec4(vec3(0.5) + (frag.normal * 0.5), 1.0);"
|
||||
" }"
|
||||
};
|
||||
/*
|
||||
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);"
|
||||
" return vec4(vec3(texture(specularMap, uv).w), 1.0);"
|
||||
" }"
|
||||
};
|
||||
*/
|
||||
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);"
|
||||
" 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_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);"
|
||||
" }"
|
||||
};
|
||||
|
||||
static const std::string DEFAULT_EMISSIVE_SHADER{
|
||||
"vec4 getFragmentColor() {"
|
||||
|
@ -211,6 +195,18 @@ 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);"
|
||||
|
@ -220,7 +216,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).xyz), 1.0);"
|
||||
" return vec4(vec3(texture(obscuranceMap, uv).x), 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);"
|
||||
" }"
|
||||
|
@ -305,6 +301,8 @@ 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:
|
||||
|
|
|
@ -72,6 +72,7 @@ protected:
|
|||
NormalCurvatureMode,
|
||||
DiffusedCurvatureMode,
|
||||
DiffusedNormalCurvatureMode,
|
||||
CurvatureOcclusionMode,
|
||||
ScatteringDebugMode,
|
||||
AmbientOcclusionMode,
|
||||
AmbientOcclusionBlurredMode,
|
||||
|
|
|
@ -67,11 +67,7 @@ DeferredFragment unpackDeferredFragmentNoPosition(vec2 texcoord) {
|
|||
frag.scattering = 0.0;
|
||||
unpackModeMetallic(diffuseVal.w, frag.mode, frag.metallic);
|
||||
|
||||
|
||||
// frag.obscurance = min(specularVal.w, frag.obscurance);
|
||||
|
||||
frag.obscurance = specularVal.w;
|
||||
|
||||
frag.obscurance = min(specularVal.w, frag.obscurance);
|
||||
|
||||
if (frag.mode == FRAG_MODE_SCATTERING) {
|
||||
frag.scattering = specularVal.x;
|
||||
|
|
|
@ -151,6 +151,7 @@ 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" }
|
||||
|
|
Loading…
Reference in a new issue