change shader lighting
This commit is contained in:
parent
63d8a67845
commit
6f9d3befb4
2 changed files with 4 additions and 14 deletions
|
@ -1,23 +1,13 @@
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (location = 0) in vec3 fragColor;
|
layout (location = 0) in float fragLight;
|
||||||
layout (location = 1) in vec2 fragUv;
|
layout (location = 1) in vec2 fragUv;
|
||||||
layout (location = 2) in flat int fragTex;
|
layout (location = 2) in flat int fragTex;
|
||||||
|
|
||||||
layout (location = 0) out vec4 outColor;
|
layout (location = 0) out vec4 outColor;
|
||||||
|
|
||||||
layout (binding = 0) uniform GlobalUbo {
|
|
||||||
mat4 projectionViewMatrix;
|
|
||||||
vec3 directionToLight;
|
|
||||||
} ubo;
|
|
||||||
|
|
||||||
layout (binding = 1) uniform sampler2D texSampler[3];
|
layout (binding = 1) uniform sampler2D texSampler[3];
|
||||||
|
|
||||||
layout(push_constant) uniform Push {
|
|
||||||
mat4 transform;
|
|
||||||
mat4 normalMatrix;
|
|
||||||
} push;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
outColor = mix(texture(texSampler[fragTex], fragUv), vec4(fragColor, 1.0), .1);
|
outColor = texture(texSampler[fragTex], fragUv) + fragLight;
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ layout (location = 1) in vec3 normal;
|
||||||
layout (location = 2) in vec2 uv;
|
layout (location = 2) in vec2 uv;
|
||||||
layout (location = 3) in int tex;
|
layout (location = 3) in int tex;
|
||||||
|
|
||||||
layout (location = 0) out vec3 fragColor;
|
layout (location = 0) out float fragLight;
|
||||||
layout (location = 1) out vec2 fragUv;
|
layout (location = 1) out vec2 fragUv;
|
||||||
layout (location = 2) out int fragTex;
|
layout (location = 2) out int fragTex;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void main() {
|
||||||
|
|
||||||
float lightIntensity = AMBIENT + max(dot(normalWorldSpace, ubo.directionToLight), 0);
|
float lightIntensity = AMBIENT + max(dot(normalWorldSpace, ubo.directionToLight), 0);
|
||||||
|
|
||||||
fragColor = lightIntensity * vec3(1);
|
fragLight = lightIntensity / 5;
|
||||||
fragUv = uv;
|
fragUv = uv;
|
||||||
fragTex = tex;
|
fragTex = tex;
|
||||||
}
|
}
|
Loading…
Reference in a new issue