Lambertian reflections implemented
This commit is contained in:
parent
6cf0166f89
commit
311be99d95
2 changed files with 68042 additions and 68041 deletions
3
main.go
3
main.go
|
@ -366,7 +366,8 @@ func Ray_color(r Ray, depth int, world *Hittable) Vec3 {
|
||||||
return NewColor(0,0,0)
|
return NewColor(0,0,0)
|
||||||
}
|
}
|
||||||
if (world.Hit(&r, *NewInterval(0.001, float32(math.Inf(1))), &rec)) {
|
if (world.Hit(&r, *NewInterval(0.001, float32(math.Inf(1))), &rec)) {
|
||||||
direction := RandomOnHemisphere(rec.normal)
|
//direction := RandomOnHemisphere(rec.normal)
|
||||||
|
direction := rec.normal.Add(RandomUnitVector())
|
||||||
return Ray_color(*((NewRay(rec.p, direction))), depth-1, world).Mult(0.5)
|
return Ray_color(*((NewRay(rec.p, direction))), depth-1, world).Mult(0.5)
|
||||||
}
|
}
|
||||||
unit_direction := Unit_vector(r.Direction())
|
unit_direction := Unit_vector(r.Direction())
|
||||||
|
|
Loading…
Reference in a new issue