diff --git a/Editor/resources/Shaders/deferred.shader b/Editor/resources/Shaders/deferred.shader index 10f8bd3b..c9d14654 100644 --- a/Editor/resources/Shaders/deferred.shader +++ b/Editor/resources/Shaders/deferred.shader @@ -242,15 +242,16 @@ void main() float distance = length(Lights[i].Position - worldPos); float attenuation = 1.0 / (distance * distance); - if (Lights[i].Type == 0) { + if (Lights[i].Type == 0) + { L = normalize(Lights[i].Direction); attenuation = 1.0f; shadow += ShadowCalculation(Lights[i], worldPos, N); } vec3 radiance = Lights[i].Color * attenuation ; - - if (Lights[i].Type == 0) { + if (Lights[i].Type == 0) + { radiance *= shadow; } @@ -281,8 +282,8 @@ void main() vec3 kD = 1.0 - kS; kD *= 1.0 - metallic; - vec3 ambient = (kD * albedo) * (ao); - vec3 color = (ambient * ssao) + Lo; + vec3 ambient = (kD * albedo) * (ao) * ssao; + vec3 color = (ambient) + Lo; // Display CSM splits.. /*float depth = length(worldPos - u_EyePosition); diff --git a/Editor/resources/Shaders/ssr.shader b/Editor/resources/Shaders/ssr.shader index 12bd89d9..494585da 100644 --- a/Editor/resources/Shaders/ssr.shader +++ b/Editor/resources/Shaders/ssr.shader @@ -176,11 +176,11 @@ void main() { } - outColor = vec4(resultingColor.xyz * Fresnel, metallic) ; + outColor = vec4(resultingColor.xyz * Fresnel, 1.0) ; } else { - outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, metallic); + outColor = vec4(SSR(position, normalize(reflectionDirection)) * Fresnel, 1.0); if (outColor.xyz == vec3(0.f)) { outColor = texture(textureFrame, UV); } diff --git a/Editor/resources/Shaders/volumetric.shader b/Editor/resources/Shaders/volumetric.shader index 9345903a..ef124b2f 100644 --- a/Editor/resources/Shaders/volumetric.shader +++ b/Editor/resources/Shaders/volumetric.shader @@ -62,8 +62,8 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light) vec3 rayVector = FragPos - startPosition; // Ray Direction float rayLength = length(rayVector); // Length of the raymarched - if(rayLength > 100) - return vec3(0); + if(rayLength > 1000.0) + return vec3(1.0, 1.0, 1.0); float stepLength = rayLength / u_StepCount; // Step length vec3 rayDirection = rayVector / rayLength; vec3 step = rayDirection * stepLength; // Normalized to step length direction diff --git a/Nuake/src/Rendering/PostFX/Volumetric.cpp b/Nuake/src/Rendering/PostFX/Volumetric.cpp index fc89ec22..a2ff4a10 100644 --- a/Nuake/src/Rendering/PostFX/Volumetric.cpp +++ b/Nuake/src/Rendering/PostFX/Volumetric.cpp @@ -38,7 +38,7 @@ namespace Nuake { mFinalFramebuffer->Clear(); RenderCommand::Disable(RendererEnum::FACE_CULL); - Vector3 cameraPosition = Vector3(view[3]); + auto cameraPosition = Vector3(view[3]); Shader* volumetricShader = ShaderManager::GetShader("resources/Shaders/volumetric.shader"); volumetricShader->Bind(); volumetricShader->SetUniformMat4f("u_Projection", projection); diff --git a/Nuake/src/Scene/EditorCamera.cpp b/Nuake/src/Scene/EditorCamera.cpp index 8e58e1b2..a0bb1613 100644 --- a/Nuake/src/Scene/EditorCamera.cpp +++ b/Nuake/src/Scene/EditorCamera.cpp @@ -34,8 +34,8 @@ namespace Nuake if (!previous && controlled) { firstMouse = true; - mouseLastX = x; - mouseLastY = y; + //mouseLastX = x; + //mouseLastY = y; } } else @@ -61,12 +61,7 @@ namespace Nuake if (Input::YScroll != 0.0f) { this->Fov += Input::YScroll; - - if (Fov < 5.0f) - { - Fov = 5.0f; - } - + Fov = glm::max(Fov, 5.0f); Input::YScroll = 0.0f; } } @@ -92,7 +87,6 @@ namespace Nuake if (Speed < 0) Speed = 0; - if (m_Type == CAMERA_TYPE::ORTHO) { if (Input::IsKeyDown(GLFW_KEY_RIGHT)) @@ -106,7 +100,7 @@ namespace Nuake } else { - glm::vec3 movement = glm::vec3(0, 0, 0); + auto movement = Vector3(0, 0, 0); if (Input::IsKeyDown(GLFW_KEY_D)) movement -= Right * (Speed * ts); @@ -175,9 +169,7 @@ namespace Nuake Translation += Vector3(Direction) * Input::YScroll; Input::YScroll = 0.0f; } - else - { - } + mouseLastX = x; mouseLastY = y; }