Made progress on point light shadows. Not quite sure what is happening.
This commit is contained in:
parent
812321edec
commit
4ae832f31c
@ -66,8 +66,12 @@ float sampleDirectionalShadow(sampler2DShadow shadowMap, vec4 shadowCoord) {
|
||||
}
|
||||
|
||||
float samplePointShadow(samplerCubeShadow shadowMap, vec3 lightDirection) {
|
||||
float nearPlane = 0.1;
|
||||
float A = -(farPlane+nearPlane)/(farPlane-nearPlane);
|
||||
float B = -2*(farPlane*nearPlane)/(farPlane - nearPlane);
|
||||
float compValue = 0.5*(-A*length(lightDirection) + B)/length(lightDirection) + 0.5;
|
||||
float bias = 0.005;
|
||||
return texture(shadowMap, vec4(lightDirection.xyz , length(lightDirection) - bias));
|
||||
return texture(shadowMap, vec4(lightDirection.xyz , compValue - bias));
|
||||
}
|
||||
|
||||
float distanceToBorder(vec2 vector) {
|
||||
|
2
level.cc
2
level.cc
@ -422,7 +422,7 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
glm::mat4* viewProjectionMatrix, std::vector<glm::mat4>* shadowVPs) {
|
||||
for(unsigned int i = 0; i<objects.size(); i++) {
|
||||
// do not project shadow of skydome
|
||||
if(lightingPass || (objects.at(i) != skydome && i!=0)) {
|
||||
if(lightingPass || (objects.at(i) != skydome /*&& i!=0*/)) {
|
||||
objects.at(i)->render(shader, lightingPass, viewProjectionMatrix, shadowVPs);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user