I’m glad about every small piece I get done, but I’m not sure whether I did it right:
As described in this post https://computergraphics.stackexchange.com/questions/4486/mimicking-blenders-roughness-in-my-path-tracer for reflection direction in a path tracer with roughness I set the angles phi and theta as polar coordinates. I put them into a derivate of function “cosine_sample_hemisphere”, which is called in the closest-hit-program of the material (see roughnessTest.jpg in attachment), where I add theta instead of the second use of phi. Phi remains calculated the same way.
const float theta = atanf( roughness * sqrt(u1) / sqrtf(1.0f - u1) ); ... p.y = r * sinf( theta );
But the result from a value of roughness = 0.0f does not produce the expected mirror effect. (even on bumpiness = 0.0f its wrong in roughnessTest.jpg)
So I tried to add a simple importance sampling (is this valid as I did it?) for roughness (see roughnessTest2.jpg in attachment; NOTE: “roughness” and “user_roughness” are the same) There is no refraction on this material, so I did not use the fresnel term for importance sampling as described in the glass Advanced sample. (that I think I need again when I want to apply the roughness using Beckmann distribution on a glass object as described in “Microfacet Models for Refraction through Rough Surfaces”)
What did I wrong?
NOTE: the normals are calculated from a TBN (tangent space matrix), which receives vertex tangents and vertex normals; a normal map is used for bump mapping also in the samples.
the used texture is the 1024x1024 “Wicker” texture from here:
the albedo map is used for “Kd” and the normal map is used for bump mapping. the roughness map yet is not applied; instead a simple value is applied. all other maps are not applied.
The back side of the cornell box uses pure reflection. (The cornell scene itself is a modified one from the denoiser sample of OptiX 5.0.0; denoiser is ON in all the test samples)
In Blender they do the roughness with Oren-Nayer model.
System: OptiX 5.0.0 CUDA 9.0 GTX 1050 Win10PRO 64bit (version 1607) device driver: 388.59 TDR re-enabled:defaults+longer delay times VS2017 (toolkit v140 of VS2015) (no crashs and no OS freezes since this configuration!)