Closed lorenzoliuzzo closed 4 months ago
I think there is a bug also here:
proc newSpecularBRDF*(pigment = newUniformPigment(WHITE), angle = 180.0): BRDF {.inline.} =
BRDF(kind: SpecularBRDF, pigment: pigment, thresholdAngle: degToRad(angle))
If the angle is set to 90, the following demo image is produced: This is wrong because we cannot see the reflection of the spheres between the central specular one and the camera, but we can see the spheres behind.
However, if angle = 180, we can see the frontal spheres being reflected:
In my opinion, we shouldn't be able to see reflected the spheres behind the central one, at most we should barely see the lateral one.
If we do not weight using the BRDF.eval, the output with the thresholdAngle set to PI/2 is this:
The problem we had before with the thresholdAngle no longer exists since we are no longer calling the function to evaluate the brdf..... However, you can see on the diffuse materials some weird points: these are the points where the rays scattered after an initial hit have hit the shape. The reason why we see them more luminous is because we are just adding the brdf.pigment color to the shape color without any information on how to weight it.
var hitCol = closestHit.handler.shape.material.brdf.pigment.getColor(surfacePt)
Cornell box with 1 samplePerSide - 4 numRays - 3 maxDepth: without BRDF.eval:
with BRDF.eval: