First part of #1988 fix
This commit is contained in:
parent
0f56a4f6d3
commit
13a2f9f597
18
data/shaders/degraded_ibl.frag
Normal file
18
data/shaders/degraded_ibl.frag
Normal file
@ -0,0 +1,18 @@
|
||||
uniform sampler2D ntex;
|
||||
|
||||
out vec4 Diff;
|
||||
out vec4 Spec;
|
||||
|
||||
vec3 DecodeNormal(vec2 n);
|
||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
vec3 DiffuseIBL(vec3 normal);
|
||||
vec3 SpecularIBL(vec3 normal, vec3 V, float roughness);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
vec3 normal = normalize(DecodeNormal(2. * texture(ntex, uv).xy - 1.));
|
||||
|
||||
Diff = vec4(0.25 * DiffuseIBL(normal), 1.);
|
||||
Spec = vec4(0., 0., 0., 1.);
|
||||
}
|
@ -654,6 +654,10 @@ namespace UserConfigParams
|
||||
PARAM_DEFAULT( IntUserConfigParam(0,
|
||||
"shadows_resoltion", &m_graphics_quality,
|
||||
"Shadow resolution (0 = disabled") );
|
||||
PARAM_PREFIX BoolUserConfigParam m_degraded_IBL
|
||||
PARAM_DEFAULT(BoolUserConfigParam(false,
|
||||
"Degraded_IBL", &m_graphics_quality,
|
||||
"Disable specular IBL"));
|
||||
|
||||
// ---- Misc
|
||||
PARAM_PREFIX BoolUserConfigParam m_cache_overworld
|
||||
|
@ -220,11 +220,22 @@ void PostProcessing::renderEnvMap(const float *bSHCoeff, const float *gSHCoeff,
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
if (UserConfigParams::m_degraded_IBL)
|
||||
{
|
||||
glUseProgram(FullScreenShader::DegradedIBLShader::getInstance()->Program);
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
|
||||
FullScreenShader::DegradedIBLShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH));
|
||||
FullScreenShader::DegradedIBLShader::getInstance()->setUniforms();
|
||||
}
|
||||
else
|
||||
{
|
||||
glUseProgram(FullScreenShader::IBLShader::getInstance()->Program);
|
||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||
|
||||
FullScreenShader::IBLShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), skybox);
|
||||
FullScreenShader::IBLShader::getInstance()->setUniforms();
|
||||
}
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
glBindVertexArray(0);
|
||||
|
@ -1641,6 +1641,19 @@ namespace FullScreenShader
|
||||
AssignSamplerNames(Program, 0, "ntex", 1, "dtex", 2, "probe");
|
||||
}
|
||||
|
||||
DegradedIBLShader::DegradedIBLShader()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/DiffuseIBL.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularIBL.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/degraded_ibl.frag").c_str());
|
||||
AssignUniforms();
|
||||
AssignSamplerNames(Program, 0, "ntex");
|
||||
}
|
||||
|
||||
ShadowedSunLightShaderPCF::ShadowedSunLightShaderPCF()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
|
@ -426,6 +426,12 @@ public:
|
||||
IBLShader();
|
||||
};
|
||||
|
||||
class DegradedIBLShader : public ShaderHelperSingleton<DegradedIBLShader>, public TextureRead<Nearest_Filtered>
|
||||
{
|
||||
public:
|
||||
DegradedIBLShader();
|
||||
};
|
||||
|
||||
class ShadowedSunLightShaderPCF : public ShaderHelperSingleton<ShadowedSunLightShaderPCF, float, float, float, float, float>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Shadow_Sampler>
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user