Rename some shader to improve their meaning
This commit is contained in:
parent
23b781e7dd
commit
fd2da4085b
@ -9,7 +9,6 @@ uniform sampler3D SHR;
|
|||||||
uniform sampler3D SHG;
|
uniform sampler3D SHG;
|
||||||
uniform sampler3D SHB;
|
uniform sampler3D SHB;
|
||||||
|
|
||||||
uniform float R_wcs = 10.;
|
|
||||||
uniform vec3 extents;
|
uniform vec3 extents;
|
||||||
uniform mat4 RHMatrix;
|
uniform mat4 RHMatrix;
|
||||||
uniform mat4 InvRHMatrix;
|
uniform mat4 InvRHMatrix;
|
||||||
|
@ -10,7 +10,7 @@ out vec4 Diffuse;
|
|||||||
out vec4 Specular;
|
out vec4 Specular;
|
||||||
|
|
||||||
vec3 DecodeNormal(vec2 n);
|
vec3 DecodeNormal(vec2 n);
|
||||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@ -38,5 +38,5 @@ void main()
|
|||||||
float NdotL = max(0., dot(norm, L));
|
float NdotL = max(0., dot(norm, L));
|
||||||
|
|
||||||
Diffuse = vec4(NdotL * light_col * att, 1.);
|
Diffuse = vec4(NdotL * light_col * att, 1.);
|
||||||
Specular = vec4(getSpecular(norm, eyedir, L, light_col, roughness) * NdotL * att, 1.);
|
Specular = vec4(SpecularBRDF(norm, eyedir, L, light_col, roughness) * NdotL * att, 1.);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ out vec4 Diff;
|
|||||||
out vec4 Spec;
|
out vec4 Spec;
|
||||||
|
|
||||||
vec3 DecodeNormal(vec2 n);
|
vec3 DecodeNormal(vec2 n);
|
||||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||||
|
|
||||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||||
@ -52,7 +52,7 @@ void main() {
|
|||||||
vec3 R = reflect(-eyedir, norm);
|
vec3 R = reflect(-eyedir, norm);
|
||||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||||
|
|
||||||
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||||
|
|
||||||
vec3 outcol = NdotL * col;
|
vec3 outcol = NdotL * col;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ out vec4 Diff;
|
|||||||
out vec4 Spec;
|
out vec4 Spec;
|
||||||
|
|
||||||
vec3 DecodeNormal(vec2 n);
|
vec3 DecodeNormal(vec2 n);
|
||||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness);
|
||||||
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||||
|
|
||||||
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
vec3 getMostRepresentativePoint(vec3 direction, vec3 R, float angularRadius)
|
||||||
@ -66,7 +66,7 @@ void main() {
|
|||||||
vec3 R = reflect(-eyedir, norm);
|
vec3 R = reflect(-eyedir, norm);
|
||||||
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
vec3 Lightdir = getMostRepresentativePoint(direction, R, angle);
|
||||||
|
|
||||||
vec3 Specular = getSpecular(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
vec3 Specular = SpecularBRDF(norm, eyedir, Lightdir, col, roughness) * NdotL;
|
||||||
|
|
||||||
|
|
||||||
vec3 outcol = NdotL * col;
|
vec3 outcol = NdotL * col;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
// Blinn Phong with emulated fresnel factor
|
||||||
|
vec3 SpecularBRDF(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
|
||||||
vec3 getSpecular(vec3 normal, vec3 eyedir, vec3 lightdir, vec3 color, float roughness)
|
|
||||||
{
|
{
|
||||||
float exponentroughness = exp2(10. * roughness + 1.);
|
float exponentroughness = exp2(10. * roughness + 1.);
|
||||||
// Half Light View direction
|
// Half Light View direction
|
@ -228,12 +228,12 @@ void PostProcessing::renderEnvMap(const float *bSHCoeff, const float *gSHCoeff,
|
|||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::EnvMapShader::getInstance()->Program);
|
glUseProgram(FullScreenShader::IBLShader::getInstance()->Program);
|
||||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
|
|
||||||
FullScreenShader::EnvMapShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), skybox);
|
FullScreenShader::IBLShader::getInstance()->SetTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH), irr_driver->getDepthStencilTexture(), skybox);
|
||||||
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
core::matrix4 TVM = irr_driver->getViewMatrix().getTransposed();
|
||||||
FullScreenShader::EnvMapShader::getInstance()->setUniforms(TVM, std::vector<float>(bSHCoeff, bSHCoeff + 9), std::vector<float>(gSHCoeff, gSHCoeff + 9), std::vector<float>(rSHCoeff, rSHCoeff + 9));
|
FullScreenShader::IBLShader::getInstance()->setUniforms(TVM, std::vector<float>(bSHCoeff, bSHCoeff + 9), std::vector<float>(gSHCoeff, gSHCoeff + 9), std::vector<float>(rSHCoeff, rSHCoeff + 9));
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
@ -1426,7 +1426,7 @@ namespace LightShader
|
|||||||
Program = LoadProgram(OBJECT,
|
Program = LoadProgram(OBJECT,
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/pointlight.vert").c_str(),
|
GL_VERTEX_SHADER, file_manager->getAsset("shaders/pointlight.vert").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/decodeNormal.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getSpecular.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/pointlight.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/pointlight.frag").c_str());
|
||||||
|
|
||||||
@ -1625,7 +1625,7 @@ namespace FullScreenShader
|
|||||||
Program = LoadProgram(OBJECT,
|
Program = LoadProgram(OBJECT,
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
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/decodeNormal.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getSpecular.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlight.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlight.frag").c_str());
|
||||||
|
|
||||||
@ -1633,13 +1633,13 @@ namespace FullScreenShader
|
|||||||
AssignUniforms("direction", "col");
|
AssignUniforms("direction", "col");
|
||||||
}
|
}
|
||||||
|
|
||||||
EnvMapShader::EnvMapShader()
|
IBLShader::IBLShader()
|
||||||
{
|
{
|
||||||
Program = LoadProgram(OBJECT,
|
Program = LoadProgram(OBJECT,
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
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/decodeNormal.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/diffuseenvmap.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/IBL.frag").c_str());
|
||||||
AssignUniforms("TransposeViewMatrix", "blueLmn[0]", "greenLmn[0]", "redLmn[0]");
|
AssignUniforms("TransposeViewMatrix", "blueLmn[0]", "greenLmn[0]", "redLmn[0]");
|
||||||
AssignSamplerNames(Program, 0, "ntex", 1, "dtex", 2, "tex");
|
AssignSamplerNames(Program, 0, "ntex", 1, "dtex", 2, "tex");
|
||||||
}
|
}
|
||||||
@ -1649,7 +1649,7 @@ namespace FullScreenShader
|
|||||||
Program = LoadProgram(OBJECT,
|
Program = LoadProgram(OBJECT,
|
||||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(),
|
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/decodeNormal.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getSpecular.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/SpecularBRDF.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getPosFromUVDepth.frag").c_str(),
|
||||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlightshadow.frag").c_str());
|
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/sunlightshadow.frag").c_str());
|
||||||
|
|
||||||
|
@ -411,10 +411,10 @@ public:
|
|||||||
SunLightShader();
|
SunLightShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnvMapShader : public ShaderHelperSingleton<EnvMapShader, core::matrix4, std::vector<float>, std::vector<float>, std::vector<float> >, public TextureRead<Nearest_Filtered, Nearest_Filtered, Trilinear_cubemap>
|
class IBLShader : public ShaderHelperSingleton<IBLShader, core::matrix4, std::vector<float>, std::vector<float>, std::vector<float> >, public TextureRead<Nearest_Filtered, Nearest_Filtered, Trilinear_cubemap>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EnvMapShader();
|
IBLShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShadowedSunLightShader : public ShaderHelperSingleton<ShadowedSunLightShader, float, float, float, float, core::vector3df, video::SColorf>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Shadow_Sampler>
|
class ShadowedSunLightShader : public ShaderHelperSingleton<ShadowedSunLightShader, float, float, float, float, core::vector3df, video::SColorf>, public TextureRead<Nearest_Filtered, Nearest_Filtered, Shadow_Sampler>
|
||||||
|
Loading…
Reference in New Issue
Block a user