From ec59f251c7a4b06de44c0f8ebf186e109d49f580 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Thu, 26 Jan 2023 20:30:59 +0100 Subject: [PATCH] Removes wrong intial value for density --- fancy1.cpp | 4 ++-- shader/cloudshader.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fancy1.cpp b/fancy1.cpp index 2936386..04271ee 100644 --- a/fancy1.cpp +++ b/fancy1.cpp @@ -28,10 +28,10 @@ int main() { FastScene scene; - scene.setBackgroundColor(Color(0.529f, 0.808f, 0.922f) * 0.2f); + scene.setBackgroundColor(Color(0.529f, 0.808f, 0.922f) * 1.0f); // Add lights - auto mainLight = std::make_shared(Vector3d(-1.0f, -0.5f, -1.0f), 10.0f, Color(1, 0.79f, 0.62f)); + auto mainLight = std::make_shared(Vector3d(-1.0f, -0.5f, -1.0f), 5.0f, Color(1, 0.79f, 0.62f)); scene.add(mainLight); // scene.add(std::make_shared(0.3f)); // auto light = std::make_shared(Vector3d(25.0f, 10.0f, 25.0f), 100.0f); diff --git a/shader/cloudshader.cpp b/shader/cloudshader.cpp index 1a88fac..6df0fd1 100644 --- a/shader/cloudshader.cpp +++ b/shader/cloudshader.cpp @@ -137,8 +137,6 @@ float CloudShader::rayDensity(const Ray &ray, float maxLength) const Vector3d startPoint = ray.origin + ray.direction * (ray.length + 0.0001f); // Determine length of cloud - float cloudLength = 0.0f; - Ray cloudRay = ray; cloudRay.origin = startPoint; cloudRay.length = INFINITY; @@ -151,14 +149,14 @@ float CloudShader::rayDensity(const Ray &ray, float maxLength) const // Something went wrong => No density return 0; } - cloudLength = std::min(cloudRay.length, maxLength - ray.length); + float cloudLength = std::min(cloudRay.length, maxLength - ray.length); // Calculate step length int noiseSamples = settings.lightSamples; float stepLength = cloudLength / (float) noiseSamples; // Step through cloud - float density = 1.0f; + float density = 0.0f; for (int i = 0; i < noiseSamples; ++i) { // Get sample point