Various bug fixes + Material setters
This commit is contained in:
parent
e35cca1830
commit
f5c912c489
5 changed files with 53 additions and 22 deletions
7
sdf.go
7
sdf.go
|
|
@ -140,7 +140,7 @@ func (s SmoothSubstractionSDF) Distance(p Vector3) (float64, Material) {
|
|||
h := math.Max(k-math.Abs(-d1-d2), 0.0)
|
||||
d := math.Max(-d1, d2) + h*h*0.25/k
|
||||
t := SmoothStep(d2-d1, -k, k)
|
||||
mat := MixMat(mat1, mat2, t, p)
|
||||
mat := MixMat(mat2, mat1, t, p)
|
||||
return d, mat
|
||||
}
|
||||
|
||||
|
|
@ -154,8 +154,9 @@ func (s SmoothIntersectionSDF) Distance(p Vector3) (float64, Material) {
|
|||
k := 4 * s.k
|
||||
d1, mat1 := s.primitive1.Distance(p)
|
||||
d2, mat2 := s.primitive2.Distance(p)
|
||||
d := math.Max(k-math.Abs(d1-d2), 0.0)
|
||||
h := math.Max(k-math.Abs(d1-d2), 0.0)
|
||||
d := math.Max(d1, d2) + h*h*0.25/k
|
||||
t := SmoothStep(d2-d1, -k, k)
|
||||
mat := MixMat(mat1, mat2, t, p)
|
||||
mat := MixMat(mat2, mat1, t, p)
|
||||
return d, mat
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue