Skip to content

Commit 82ee23c

Browse files
committed
offset ray origin by geometric normal, not ray dir
1 parent 8d8b4af commit 82ee23c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

include/nbl/builtin/hlsl/path_tracing/concepts.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ NBL_CONCEPT_END(
106106
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((closest_hit.getObjectID()), ::nbl::hlsl::is_same_v, typename T::object_handle_type))
107107
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((closest_hit.getPosition()), ::nbl::hlsl::is_same_v, typename T::vector3_type))
108108
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((closest_hit.getInteraction()), ::nbl::hlsl::is_same_v, typename T::interaction_type))
109+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((closest_hit.getGeometricNormal()), ::nbl::hlsl::is_same_v, typename T::vector3_type))
109110
);
110111
#undef closest_hit
111112
#include <nbl/builtin/hlsl/concepts/__end.hlsl>

include/nbl/builtin/hlsl/path_tracing/unidirectional.hlsl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ struct Unidirectional
127127
nee_ray.init(origin, direction);
128128
nee_ray.template setInteraction<anisotropic_interaction_type>(interaction);
129129
nee_ray.setT(t);
130-
tolerance_method_type::template adjust<ray_type>(nee_ray, direction, depth);
130+
tolerance_method_type::template adjust<ray_type>(nee_ray, intersectData.getGeometricNormal(), depth);
131131
if (getLuma(neeContrib.quotient) > lumaContributionThreshold)
132132
ray.addPayloadContribution(neeContrib.quotient * intersector_type::traceShadowRay(scene, nee_ray, ret.getLightObjectID()));
133133
}
@@ -164,8 +164,7 @@ struct Unidirectional
164164
vector3_type direction = bxdfSample;
165165
ray.init(origin, direction);
166166
ray.template setInteraction<anisotropic_interaction_type>(interaction);
167-
ray.setT(1.0/*kSceneSize*/);
168-
tolerance_method_type::template adjust<ray_type>(ray, direction, depth);
167+
tolerance_method_type::template adjust<ray_type>(ray, intersectData.getGeometricNormal(), depth);
169168

170169
return true;
171170
}

0 commit comments

Comments
 (0)