cloudy-raytracer/shader/depthshader.cpp

13 lines
331 B
C++
Raw Permalink Normal View History

2023-01-23 04:09:48 +01:00
#include "depthshader.h"
Color DepthShader::shade(const Scene &scene, const Ray &ray) const
{
float brightness = exp(-ray.length * 0.1f);
return brightness * nearColor + (1 - brightness) * farColor;
}
DepthShader::DepthShader(const Color &nearColor, const Color &farColor) : nearColor(nearColor), farColor(farColor)
{
}