Fix background MIS, NumShadowRays != 1 and some few other tweaks - #37
Conversation
This puts NumShadowRays into BidirBase. Fixes CameraStoringVCM, ClassicBidir, VertexCacheBidir and VCM.
| pdfNextEvent *= backgroundProbability; | ||
| // Compute the pdf of sampling the same connection via next event estimation. | ||
| float pdfNextEvent = NextEventPdf(new SurfacePoint { Position = ray.Origin }, | ||
| new SurfacePoint { Position = ray.Origin + ray.Direction }); |
There was a problem hiding this comment.
Btw, this isn't the best approach, given that we only care about the direction. But improving this would have needed larger changes.
There was a problem hiding this comment.
why not just do a * NumShadowRays here then instead of obfuscating the code with arbitrary parameter values?
There was a problem hiding this comment.
because thats what all the VertexCacheBidir and others did as well.
There was a problem hiding this comment.
or do you mean the new SurfacePoint ... stuff?
There was a problem hiding this comment.
yes, why create arbitrary SurfacePoint objects if you can just do the missing multiplication here directly
There was a problem hiding this comment.
Encapsulation and one place to change the PDF computation, but yes it works with "just" multiplying too
| { | ||
| base.Render(scene); | ||
| } | ||
| catch |
There was a problem hiding this comment.
Why dispose on exception but keep otherwise?
There was a problem hiding this comment.
It does get disposed at the end of the function as usual, but due to the exception it never reaches so far.
| pdfNextEvent *= backgroundProbability; | ||
| // Compute the pdf of sampling the same connection via next event estimation. | ||
| // TODO get the actual previous point (need the mesh, not just the position) | ||
| float pdfNextEvent = NextEventPdf(new SurfacePoint(), SurfacePoint.Invalid); |
There was a problem hiding this comment.
isn't that trash parameters now? What happens with to.Position - from.Position in NextEventPdf?
Handling of
NumShadowRaysis now inBidirBase. This fixes wrong pdf scaling whenNumShadowRays != 1.NumShadowRays == 1stays identical to previous results. Tests still fine.All fixes are propagated to
CameraStoringVCMas well.Also includes: