fix ssao
This commit is contained in:
parent
021cfd8a1e
commit
3e66ff5924
@ -7,7 +7,7 @@ uniform samplerCube u_skybox;
|
||||
|
||||
void main(){
|
||||
vec3 dir = normalize(v_coord);
|
||||
f_position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
f_position = vec4(0.0, 0.0, -1e9, 1.0);
|
||||
f_normal = vec4(0.0);
|
||||
f_color = texture(u_skybox, dir);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#param vec3 u_ssaoSamples[64]
|
||||
#param int u_kernelSize = 16
|
||||
#param float u_radius = 0.2
|
||||
#param float u_radius = 0.4
|
||||
#param float u_bias = 0.006
|
||||
|
||||
vec4 effect() {
|
||||
@ -32,5 +32,5 @@ vec4 effect() {
|
||||
|
||||
float z = -position.z * 0.01;
|
||||
z = max(0.0, 1.0 - z);
|
||||
return vec4(occlusion, 0.0, 0.0, 1.0);
|
||||
return vec4(mix(1.0, occlusion, z), 0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@ -155,7 +155,6 @@ void GBuffer::bind() {
|
||||
|
||||
void GBuffer::bindSSAO() const {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, ssaoFbo);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void GBuffer::unbind() {
|
||||
|
||||
@ -378,7 +378,12 @@ void WorldRenderer::generateShadowsMap(
|
||||
t += 1.0f;
|
||||
}
|
||||
t = fmod(t, 0.5f);
|
||||
float sunAngle = glm::radians(90.0f - (((int)(t*1000)) / 1000.0f + 0.25f) * 360.0f);
|
||||
|
||||
float sunCycleStep = 1.0f / 1000.0f;
|
||||
float sunAngle = glm::radians(
|
||||
90.0f -
|
||||
((static_cast<int>(t / sunCycleStep)) * sunCycleStep + 0.25f) * 360.0f
|
||||
);
|
||||
shadowCamera.rotate(
|
||||
sunAngle,
|
||||
glm::radians(-45.0f),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user