use Lambertian reflection

main
jbb01 6 months ago
parent 8e77662b33
commit 0f122e2062

@ -134,10 +134,7 @@ public final class Camera {
if (optional.isPresent()) { if (optional.isPresent()) {
var result = optional.get(); var result = optional.get();
var newDirection = Vec3.random(true); var newDirection = result.normal().plus(Vec3.random(true));
if (result.normal().times(newDirection) < 0) {
newDirection = newDirection.times(-1);
}
var scattered = new Ray(result.position(), newDirection); var scattered = new Ray(result.position(), newDirection);
return Color.lerp(Color.BLACK, getColor(scene, scattered, depth - 1), 0.5); return Color.lerp(Color.BLACK, getColor(scene, scattered, depth - 1), 0.5);

Loading…
Cancel
Save