Fix SSAO on splatting material.
This commit is contained in:
parent
768d51d0c3
commit
bcc2196ccf
@ -3,10 +3,6 @@ uniform sampler2D tex_detail0;
|
||||
uniform sampler2D tex_detail1;
|
||||
uniform sampler2D tex_detail2;
|
||||
uniform sampler2D tex_detail3;
|
||||
uniform sampler2D DiffuseMap;
|
||||
uniform sampler2D SpecularMap;
|
||||
uniform sampler2D SSAO;
|
||||
uniform vec3 ambient;
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
in vec2 uv;
|
||||
@ -18,26 +14,22 @@ varying vec2 uv_bis;
|
||||
#define FragColor gl_FragColor
|
||||
#endif
|
||||
|
||||
vec3 getLightFactor(float specMapValue);
|
||||
|
||||
void main() {
|
||||
// Splatting part
|
||||
vec4 splatting = texture(tex_layout, uv_bis);
|
||||
vec4 detail0 = texture(tex_detail0, uv);
|
||||
vec4 detail1 = texture(tex_detail1, uv);
|
||||
vec4 detail2 = texture(tex_detail2, uv);
|
||||
vec4 detail3 = texture(tex_detail3, uv);
|
||||
vec4 detail4 = vec4(0.0);
|
||||
// Splatting part
|
||||
vec4 splatting = texture(tex_layout, uv_bis);
|
||||
vec4 detail0 = texture(tex_detail0, uv);
|
||||
vec4 detail1 = texture(tex_detail1, uv);
|
||||
vec4 detail2 = texture(tex_detail2, uv);
|
||||
vec4 detail3 = texture(tex_detail3, uv);
|
||||
vec4 detail4 = vec4(0.0);
|
||||
|
||||
vec4 splatted = splatting.r * detail0 +
|
||||
splatting.g * detail1 +
|
||||
splatting.b * detail2 +
|
||||
max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
|
||||
vec4 splatted = splatting.r * detail0 +
|
||||
splatting.g * detail1 +
|
||||
splatting.b * detail2 +
|
||||
max(0., (1.0 - splatting.r - splatting.g - splatting.b)) * detail3;
|
||||
|
||||
vec2 tc = gl_FragCoord.xy / screen;
|
||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||
float ao = texture(SSAO, tc).x;
|
||||
vec3 LightFactor = ao * ambient + DiffuseComponent + SpecularComponent;
|
||||
|
||||
FragColor = vec4(splatted.xyz * LightFactor, 1.);
|
||||
vec3 LightFactor = getLightFactor(1.);
|
||||
FragColor = vec4(splatted.xyz * LightFactor, 1.);
|
||||
}
|
||||
|
@ -878,6 +878,7 @@ namespace MeshShader
|
||||
{
|
||||
Program = LoadProgram(
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/splatting.frag").c_str());
|
||||
AssignUniforms("ModelMatrix");
|
||||
TU_tex_layout = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user