Closed tgrant-nv closed 1 week ago
Does this fully replace #1829? Should we close that other one to avoid confusion?
@chellmuth and @aconty does this look reasonable to you? On an absolute scale, but also, using a set of idioms that make it a decent proxy for what we care about in a real renderer?
@tgrant-nv This LGTM, I ran tests on my machine and came up with all sorts of failures (not your fault). The vector2/color2 tests are unrelated, I will look into that separately. But there were lots of optix tests that failed because of relatively small number of differences in the sampling noise. I see you added reference images, but even those didn't match quite right for me -- maybe different version of optix, or driver? Anyway, loosening up the thresholds did the trick. (I also changed the names of your ref images to the usual convention, a very nit-picky thing.)
So I went to push these updates on top of your branch, and it wouldn't let me, despite this very page saying "Maintainers are allowed to edit this pull request" -- I get an error "Authentication required: You must have push access to verify locks". I can do this to PRs on OIIO, but not on OSL, for reasons I don't understand.
So, could I trouble you to please take the optix-testrender-overhaul-take2 branch from my "lgritz" account (it's public) and then push that to yours, to amend this PR?
Description
This PR is a continuation of #1829, updated to include the recently added triangle mesh support. It enables full path tracing support for the OptiX backend in
testrender
. We have tried to share code between the CPU and OptiX backends where practical. There is more sharing in this PR than there was in #1829, which should reduce the maintenance burden a bit.ID-based dispatch
Virtual function calls aren't well supported in OptiX, so rather than using regular C++ polymorphism to invoke the
sample()
,eval()
, andget_albedo()
functions for each of the BSDF sub-types, we manually invoke the correct function based on the closure ID (which we have added as a member of theBSDF
class).Iterative closure evaluation
Another key change is the non-recursive closure evaluation. We apply the same style of iterative tree traversal used in the previous OptiX version of
process_closure()
to the shared implementations ofprocess_closure()
,evaluate_layer_opacity()
,process_medium_closure()
, andprocess_background_closure()
.Background sampling
We've included support for background closures. This includes an OptiX implementation of the
Background::prepare()
function. We've broken that function into three phases, where phases 1 and 3 are parallelized across a warp and phase 2 is executed on a single thread. This offers a decent speedup over a single-threaded implementation without the complexity of a more sophisticated implementation.Tests
I have enabled the
render-*
tests for OptiX mode. I've added alternative reference images, since the GPU output exceeds the difference threshold on many of the tests. But in most cases the difference between the CPU and GPU output is very small.Checklist: