Skip to content

Commit

Permalink
Merge pull request #1294 from iaomw/ndio
Browse files Browse the repository at this point in the history
Oidn for Volume
  • Loading branch information
littlemine authored Aug 25, 2023
2 parents 5dd6fe8 + e8ce6fa commit 977a56c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions zenovis/xinxinoptix/volume.cu
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,15 @@ extern "C" __global__ void __closesthit__radiance_volume()
float2 uu = {rnd(prd->seed), rnd(prd->seed)};
auto prob = hg.Sample_p(-ray_dir, new_dir, uu);
//auto relative_prob = prob * (CUDART_PI_F * 4);
ray_dir = normalize(new_dir);;
new_dir = normalize(new_dir);
if (prd->trace_denoise_normal) {
prd->tmp_normal = 0.5f * (-ray_dir + new_dir);
}
ray_dir = new_dir;

if(prd->trace_denoise_albedo) {
prd->tmp_albedo = vol_out.albedo;
}
scattering = s_prob_rgb * (_prob_rgb - a_prob_rgb) / _prob_rgb; // scattering prob
break;
} else {
Expand Down Expand Up @@ -565,7 +572,7 @@ extern "C" __global__ void __closesthit__radiance_volume()
shadow_prd.nonThinTransHit = 0;
shadow_prd.shadowAttanuation = make_float3(1.0f);

scattering *= vol_out.albedo;
scattering = vol_out.albedo;

if(rnd(prd->seed)<=0.5f) {
bool computed = false;
Expand Down Expand Up @@ -638,10 +645,12 @@ extern "C" __global__ void __closesthit__radiance_volume()
float ray_prob = hg.p(-ray_dir, sun_dir);
float3 lbrdf = scattering * clamp(ray_prob, 0.0f, 1.0f);

prd->radiance = light_attenuation * params.sunLightIntensity * 2.0f * lbrdf *
float3(envSky(sun_dir, sunLightDir, make_float3(0., 0., 1.),
10, // be careful
.45f, 15.f, 1.030725f * 0.3f, params.elapsedTime));
float tmpPdf;
auto illum = float3(envSky(sun_dir, sunLightDir, make_float3(0., 0., 1.),
40, // be careful
.45, 15., 1.030725f * 0.3f, params.elapsedTime, tmpPdf));

prd->radiance = light_attenuation * params.sunLightIntensity * 2.0f * lbrdf * illum;
}

prd->CH = 1.0;
Expand Down

0 comments on commit 977a56c

Please sign in to comment.