mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 10:28:57 +02:00
Introducing a fix to the graphics bug
This commit is contained in:
parent
aae7349c40
commit
da1355dc32
5 changed files with 36 additions and 14 deletions
|
@ -29,7 +29,7 @@
|
|||
#include <GL/wglew.h>
|
||||
|
||||
// Uncomment this define and recompile to be able to avoid code path preventing to be able to run nsight graphics debug
|
||||
#define HIFI_ENABLE_NSIGHT_DEBUG 1
|
||||
//#define HIFI_ENABLE_NSIGHT_DEBUG 1
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -85,13 +85,30 @@ 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);"
|
||||
// " 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_EMISSIVE_SHADER{
|
||||
"vec4 getFragmentColor() {"
|
||||
|
|
|
@ -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.7369;
|
||||
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369f;
|
||||
}
|
||||
<@endif@>
|
||||
|
||||
|
@ -83,13 +83,12 @@ void evalLightingAmbient(out vec3 diffuse, out vec3 specular, LightAmbient ambie
|
|||
specular = evalAmbientSpecularIrradiance(ambient, eyeDir, normal, roughness) * ambientFresnel;
|
||||
|
||||
<@if supportScattering@>
|
||||
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) {
|
||||
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);
|
||||
|
||||
// Diffuse from ambient
|
||||
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
||||
|
|
|
@ -16,15 +16,20 @@
|
|||
<@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;
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ Column {
|
|||
"Directional:LightingModel:enableDirectionalLight",
|
||||
"Point:LightingModel:enablePointLight",
|
||||
"Spot:LightingModel:enableSpotLight",
|
||||
"Light Contour:LightingModel:showLightContour"
|
||||
"Light Contour:LightingModel:showLightContour",
|
||||
"Shadow:RenderShadowTask:enabled"
|
||||
]
|
||||
CheckBox {
|
||||
text: modelData.split(":")[0]
|
||||
|
|
Loading…
Reference in a new issue