Open JonSargent opened 3 years ago
Repeating the "simple_example" test on other devices revealed the following relative errors for PATHOCL glossy2 specular reflectance:
It's clear that the magnitude of the error is GPU specific -- and non existent when building the same CL kernels on a CPU (at least on the one compatible device I have). It's also clear that scope of the error is limited. The diffuse component calculates just fine, as does the specular component for non-glossy materials (e.g. glass). Not sure what about the SchlickBSDF_Coating* cl funcs (?) could be device sensitive, but maybe that's a place to start looking.
I'm having trouble validating the specular behavior of glossy* materials using the PATHOCL engine on GPUs.
This zip file contains two stripped down test scenes:
Simple example: Just an ortho camera pointing at a glossy2 surface, with a light behind the camera view. Pixel rays leave the camera, bounce off the test surface at normal incidence, and then hit the light (which has a luminous intensity of 1). As far as specular reflection tests go, this is as simple as it gets. A surface with kd=0 and ks=0.5 should have a luminance of 0.5 in the rendering. This is exactly what the PATHCPU engine reports. The PATHOCL engine, on the other hand, reports a value that's 12% too low -- at least on my GPU (NVIDIA GeForce RTX 2080 Ti, see log for details). The simulation has converged nicely, so noise is not the issue.
Incidence angle study: Similar logic, but using 90 surfaces angled away from the camera plane in 1-degree increments (from 0 to 89 degrees). Just a cheap hack for turning one ortho rendering into a discrete plot of specular reflection vs. incidence-angle. Here's what it shows for glossy2 surfaces with ks=0.25, 0.5, and 0.75. The PATHCPU results are spot on. Ks values fit exactly, and the fresnel effect pushes the reflectance toward 1 at grazing angles, as expected: The PATHOCL results, though, are again systematically low: Plotting the relative error looks like this: Three different ks values, every possible incidence angle, same result: a systematic error of about -12%. I haven't been brave enough to wade into the CL engine code, but hopefully the pattern points to a simple cause? Let me know if I can be of use with troubleshooting. I should have access to a few other GPUs over the course of the next week, so I can at least see if the pattern repeats.
Originally posted by @JonSargent in https://github.com/LuxCoreRender/LuxCore/issues/470#issuecomment-730796543