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;
|
in vec4 fragPosition;
|
||||||
|
|
||||||
out float fragmentDepth;
|
out float gl_FragDepth;
|
||||||
|
|
||||||
void main() {
|
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;
|
float bias = 0.005;
|
||||||
//return texture(shadowMap, vec4(lightDirection , compValue - bias));
|
//return texture(shadowMap, vec4(lightDirection , compValue - bias));
|
||||||
float value1 = texture(shadowMap, vec3(lightDirection));
|
float value1 = texture(shadowMap, vec3(lightDirection));
|
||||||
return value1 - compValue;
|
return value1 - length(lightDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
float distanceToBorder(vec2 vector) {
|
float distanceToBorder(vec2 vector) {
|
||||||
@ -116,7 +116,7 @@ void main()
|
|||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
//visibility = samplePointShadow(shadowMap_cube, lightDirection);
|
//visibility = samplePointShadow(shadowMap_cube, lightDirection);
|
||||||
float value = 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);
|
oColor = vec4(0, 255, 0, 255);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -124,9 +124,9 @@ void Graphics::render(double time)
|
|||||||
viewMatrix[3][0], viewMatrix[3][1], viewMatrix[3][2], viewMatrix[3][3]
|
viewMatrix[3][0], viewMatrix[3][1], viewMatrix[3][2], viewMatrix[3][3]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
std::vector<glm::mat4> vector = std::vector<glm::mat4>();
|
std::vector<glm::mat4> foovector = std::vector<glm::mat4>();
|
||||||
vector.push_back(viewMatrix);
|
foovector.push_back(viewMatrix);
|
||||||
level->render(depthShader, false, &depthViewProjectionMatrix_face, &vector);
|
level->render(depthShader, false, &depthViewProjectionMatrix_face, &foovector);
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer_cube->getObjectName());
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer_cube_mirror->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);
|
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);
|
sizeof(shadowMVPs), false, (GLfloat*) shadowMVPs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//shader->setUniform("modelViewMatrix", shadowVPs->at(0) * modelMatrix);
|
if (shadowVPs) {
|
||||||
|
shader->setUniform("modelViewMatrix", shadowVPs->at(0) * modelMatrix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
glm::mat4 mvp = (*viewProjectionMatrix) * modelMatrix;
|
glm::mat4 mvp = (*viewProjectionMatrix) * modelMatrix;
|
||||||
shader->setUniform("modelViewProjectionMatrix", mvp);
|
shader->setUniform("modelViewProjectionMatrix", mvp);
|
||||||
|
Loading…
Reference in New Issue
Block a user