mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 14:47:01 +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>
|
#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
|
// 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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -85,13 +85,30 @@ static const std::string DEFAULT_NORMAL_SHADER {
|
||||||
" return vec4(vec3(0.5) + (frag.normal * 0.5), 1.0);"
|
" return vec4(vec3(0.5) + (frag.normal * 0.5), 1.0);"
|
||||||
" }"
|
" }"
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
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);"
|
||||||
|
" 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{
|
static const std::string DEFAULT_EMISSIVE_SHADER{
|
||||||
"vec4 getFragmentColor() {"
|
"vec4 getFragmentColor() {"
|
||||||
|
|
|
@ -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.7369;
|
return 1.0f - (0.0022f * k * k) + (0.0776f * k) + 0.7369f;
|
||||||
}
|
}
|
||||||
<@endif@>
|
<@endif@>
|
||||||
|
|
||||||
|
@ -83,13 +83,12 @@ 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@>
|
||||||
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) {
|
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 from ambient
|
||||||
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
diffuse = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(ambient), lowNormalCurvature.xyz).xyz;
|
||||||
|
|
|
@ -16,15 +16,20 @@
|
||||||
<@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,7 +63,8 @@ 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]
|
||||||
|
|
Loading…
Reference in a new issue