Removes wrong intial value for density

This commit is contained in:
Maximilian Giller 2023-01-26 20:30:59 +01:00
parent cc5b66e338
commit ec59f251c7
2 changed files with 4 additions and 6 deletions

View file

@ -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<SunLight>(Vector3d(-1.0f, -0.5f, -1.0f), 10.0f, Color(1, 0.79f, 0.62f));
auto mainLight = std::make_shared<SunLight>(Vector3d(-1.0f, -0.5f, -1.0f), 5.0f, Color(1, 0.79f, 0.62f));
scene.add(mainLight);
// scene.add(std::make_shared<AmbientLight>(0.3f));
// auto light = std::make_shared<PointLight>(Vector3d(25.0f, 10.0f, 25.0f), 100.0f);

View file

@ -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