Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Sep 22, 2023
1 parent a7ba1d1 commit 9a644dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions zenovis/xinxinoptix/DeflMatShader.cu
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ extern "C" __global__ void __anyhit__shadow_cutout()
bv0 = meshMat * bv0;
bv1 = meshMat * bv1;
bv2 = meshMat * bv2;
float3 v0 = make_float3(bv0.x, bv0.y, bv0.z);
float3 v1 = make_float3(bv1.x, bv1.y, bv1.z);
float3 v2 = make_float3(bv2.x, bv2.y, bv2.z);
float3& v0 = *(float3*)&bv0; //make_float3(bv0.x, bv0.y, bv0.z);
float3& v1 = *(float3*)&bv1; //make_float3(bv1.x, bv1.y, bv1.z);
float3& v2 = *(float3*)&bv2; //make_float3(bv2.x, bv2.y, bv2.z);

float3 N_0 = normalize( cross( normalize(v1-v0), normalize(v2-v0) ) );

Expand Down Expand Up @@ -509,9 +509,9 @@ extern "C" __global__ void __closesthit__radiance()
bv0 = meshMat * bv0;
bv1 = meshMat * bv1;
bv2 = meshMat * bv2;
float3 v0 = make_float3(bv0.x, bv0.y, bv0.z);
float3 v1 = make_float3(bv1.x, bv1.y, bv1.z);
float3 v2 = make_float3(bv2.x, bv2.y, bv2.z);
float3& v0 = *(float3*)&bv0; //make_float3(bv0.x, bv0.y, bv0.z);
float3& v1 = *(float3*)&bv1; //make_float3(bv1.x, bv1.y, bv1.z);
float3& v2 = *(float3*)&bv2; //make_float3(bv2.x, bv2.y, bv2.z);

float3 N_0 = normalize( cross( normalize(v1-v0), normalize(v2-v1) ) ); // this value has precision issue for big float

Expand Down
2 changes: 1 addition & 1 deletion zenovis/xinxinoptix/Light.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void DirectLighting(RadiancePRD *prd, RadiancePRD& shadow_prd, const float3& sha

light_attenuation = shadow_prd.shadowAttanuation;

if (length(light_attenuation) > 0.0f) {
if (lengthSquared(light_attenuation) > 0.0f) {

auto bxdf_value = evalBxDF(lsr.dir, wo, scatterPDF);
auto misWeight = 1.0f;
Expand Down
3 changes: 2 additions & 1 deletion zenovis/xinxinoptix/Shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ struct SphereShape {

float3 f = ray_origin - center;
float b2 = dot(f, ray_dir);
if (b2 >= 0) { return false; }

float r2 = radius * radius;

float3 fd = f - b2 * ray_dir;
Expand All @@ -264,7 +266,6 @@ struct SphereShape {
lsr->dir = ray_dir;
lsr->dist = fminf(c/q, q);
lsr->p = ray_origin + ray_dir * lsr->dist;

// lsr->n = normalize(lsr->p - center);
// lsr->p = rtgems::offset_ray(lsr->p, lsr->n);
// lsr->dist = length(lsr->p - ray_origin);
Expand Down

0 comments on commit 9a644dd

Please sign in to comment.