apply gamma correction

main
jbb01 6 months ago
parent 0f122e2062
commit cf0ed6f13f

@ -21,9 +21,10 @@ public final class Camera {
private final @NotNull Vec3 origin;
private final @NotNull Vec3 direction;
// antialiasing
// rendering
private final int samplesPerPixel = 100;
private final int maxDepth = 10;
private final double gamma = 2.0;
// internal properties
private final @NotNull Vec3 pixelU;
@ -103,7 +104,11 @@ public final class Camera {
b += color.b();
}
image.set(x, y, new Color(r / samplesPerPixel, g / samplesPerPixel, b / samplesPerPixel));
image.set(x, y, new Color(
Math.pow(r / samplesPerPixel, 1 / gamma),
Math.pow(g / samplesPerPixel, 1 / gamma),
Math.pow(b / samplesPerPixel, 1 / gamma)
));
}
}

Loading…
Cancel
Save