I’ve seen @joaovbs96 's post https://devtalk.nvidia.com/default/topic/1045484/optix/examples-of-participating-media-volumes-in-optix-/post/5305710/#5305710 and the related blog post https://joaovbs96.github.io/optix/2018/12/24/next-week.html#ch8
I integrated the volume sphere for constant medium only (of chapter 8) in a pathtracer. The pathtracer is based on Detlef’s OptiX Advanced Introduction samples. Generally the constant medium sphere works fine, but as seen in the attachment:
1. some black artefacts pixels remain (even after HDR Denoising). What could they possbily be? How could I remove them?
2. RNG Noise seems to require long convergence times. What noise type is recommened for this? Blue Noise?
I tried DRand48 noise (as presented in the example), but even after 500 iterations still visible artefacts.
3. environment map is not visible through the medium. (although density is 0.0001f); the intersction program should simply pass through on the sphere border, shouldn’t it ?
1. the “black dots” were caused by negative depth values; such values caused my engine to skip these pixels; solved now!
2. see question: https://devtalk.nvidia.com/default/topic/1060776/optix/best-noise-for-pathtracer-/
3. after adding this code :
if (hit_distance > (distance_inside_boundary - 0.01f)) return;
in hit_sphere() the env map is visible on lower density
In the closest hit (isotropic) program I use:
thePrd.radiance = make_float3(0.0f); // instead of prd.out.emitted = emitted(); thePrd.pdf = 1.0f; // to avoid termination of the ray thePrd.f_over_pdf = const_color; // instead of prd.out.attenuation thePrd.pos = hit_rec_p; // instead of prd.out.scattered_origin thePrd.wi = random_in_unit_sphere(make_float3(rng2(thePrd.seed), rng(thePrd.seed)) ); // instead of prd.out.scattered_direction thePrd.distance = optix::length(thePrd.pos - theRay.origin); // instead of theIntersectionDistance;
changes in intersection programs:
- hit_rec_u, hit_rec_v removed, since nowhere used in a constant medium (only one color; no texture)
- hit_rec_normal removed, since nowhere used in closesthit
#define FLT_MAX 1e30 distance_inside_boundary *= optix::length(ray.direction); // instead of vec3f(ray.direction).length(); float hit_distance = -(1.0f / density) * log(rng(thePrd.seed)); // instead of -(1.0f / density) * log((*prd.in.randState)()); float temp = rec1 + hit_distance / optix::length(ray.direction); // instead of rec1 + hit_distance / vec3f(ray.direction).length();
in ray gen:
Min Path = 50 (so russian roulette is never applied)
Max Path = 50
Thanx for any advice!
System: OptiX 6.0.0 SDK CUDA 10.0 GTX 1050 2GB Win10PRO 64bit (version 1809) device driver: 431.36 VS2017/VS2019 (toolkit v140 of VS2015)