Changed how depth values are written. Works even less than before.
This commit is contained in:
parent
c757b80fa9
commit
aba2b07df4
@ -2,8 +2,9 @@
|
||||
|
||||
in vec4 fragPosition;
|
||||
|
||||
out float fragmentDepth;
|
||||
out float gl_FragDepth;
|
||||
|
||||
void main() {
|
||||
fragmentDepth = fragPosition.z;
|
||||
gl_FragDepth = fragPosition.z;
|
||||
//gl_FragDepth = 0.0f;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ float samplePointShadow(samplerCube shadowMap, vec3 lightDirection) {
|
||||
float bias = 0.005;
|
||||
//return texture(shadowMap, vec4(lightDirection , compValue - bias));
|
||||
float value1 = texture(shadowMap, vec3(lightDirection));
|
||||
return value1 - compValue;
|
||||
return value1 - length(lightDirection);
|
||||
}
|
||||
|
||||
float distanceToBorder(vec2 vector) {
|
||||
@ -116,7 +116,7 @@ void main()
|
||||
if (i == 0) {
|
||||
//visibility = samplePointShadow(shadowMap_cube, lightDirection);
|
||||
float value = samplePointShadow(shadowMap_cube, lightDirection);
|
||||
if (abs(value) < 0.0001f) {
|
||||
if (abs(value) < 0.1f) {
|
||||
oColor = vec4(0, 255, 0, 255);
|
||||
}
|
||||
else {
|
||||
|
@ -124,9 +124,9 @@ void Graphics::render(double time)
|
||||
viewMatrix[3][0], viewMatrix[3][1], viewMatrix[3][2], viewMatrix[3][3]
|
||||
);
|
||||
}
|
||||
std::vector<glm::mat4> vector = std::vector<glm::mat4>();
|
||||
vector.push_back(viewMatrix);
|
||||
level->render(depthShader, false, &depthViewProjectionMatrix_face, &vector);
|
||||
std::vector<glm::mat4> foovector = std::vector<glm::mat4>();
|
||||
foovector.push_back(viewMatrix);
|
||||
level->render(depthShader, false, &depthViewProjectionMatrix_face, &foovector);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube_mirror->getObjectName());
|
||||
glBlitFramebuffer(0, 0, cube_size, cube_size, cube_size, cube_size, 0, 0, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||
|
@ -33,7 +33,9 @@ void Object::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
sizeof(shadowMVPs), false, (GLfloat*) shadowMVPs);
|
||||
}
|
||||
else {
|
||||
//shader->setUniform("modelViewMatrix", shadowVPs->at(0) * modelMatrix);
|
||||
if (shadowVPs) {
|
||||
shader->setUniform("modelViewMatrix", shadowVPs->at(0) * modelMatrix);
|
||||
}
|
||||
}
|
||||
glm::mat4 mvp = (*viewProjectionMatrix) * modelMatrix;
|
||||
shader->setUniform("modelViewProjectionMatrix", mvp);
|
||||
|
Loading…
Reference in New Issue
Block a user