diff --git a/cw 9/shaders/shader_9_1.frag b/cw 9/shaders/shader_9_1.frag index 1025af3..2205051 100644 --- a/cw 9/shaders/shader_9_1.frag +++ b/cw 9/shaders/shader_9_1.frag @@ -2,7 +2,7 @@ float AMBIENT = 0.03; float PI = 3.14; -float shadowBias = 0.0; +float shadowBias = 0.01; uniform sampler2D depthMap; diff --git a/cw 9/src/ex_9_1.hpp b/cw 9/src/ex_9_1.hpp index 89c77dc..19c95ab 100644 --- a/cw 9/src/ex_9_1.hpp +++ b/cw 9/src/ex_9_1.hpp @@ -45,6 +45,7 @@ GLuint programTest; GLuint programTex; GLuint programDepth; +glm::mat4 lightVP; Core::Shader_Loader shaderLoader; @@ -130,7 +131,6 @@ void drawObjectPBR(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, depthMap); - glm::mat4 lightVP = glm::ortho(-3.f, 3.f, -3.f, 3.f, 1.f, 30.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); glUniformMatrix4fv(glGetUniformLocation(program, "LightVP"), 1, GL_FALSE, (float*)&lightVP); glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix(); @@ -182,7 +182,8 @@ void renderShadowapSun() { glUseProgram(programDepth); //viewProjection matrix - glm::mat4 lightVP = glm::ortho(-2.9f, 2.2f, -1.1f, 2.7f, 1.f, 30.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); + lightVP = glm::ortho(-2.9f, 2.2f, -1.1f, 2.7f, 1.f, 30.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); + //lightVP = glm::ortho(-10.f, 10.f, -10.f, 10.f, 1.f, 30.0f) * glm::lookAt(sunPos, sunPos - sunDir, glm::vec3(0, 1, 0)); //draw //lamp