@@ -85,14 +85,7 @@ struct Unidirectional
8585 vector3_type eps1 = randGen (depth * 2u + 1u, _sample);
8686
8787 const vector3_type intersectP = intersectData.getPosition ();
88- vector3_type throughput = ray.getPayloadThroughput ();
89- measure_type throughputCIE_Y = spectralTypeToLumaCoeffs * throughput;
90- {
91- scalar_type sum_throughput = throughputCIE_Y[0 ];
92- NBL_UNROLL for (uint16_t i = 1 ; i < vector_traits<measure_type>::Dimension; i++)
93- sum_throughput += throughputCIE_Y[i];
94- throughputCIE_Y /= sum_throughput;
95- }
88+ measure_type throughputCIE_Y = interaction.getLuminosityContributionHint ();
9689
9790 // sample lights
9891 const scalar_type neeProbability = bxdf.getNEEProb ();
@@ -132,7 +125,7 @@ struct Unidirectional
132125 const vector3_type direction = nee_sample.getL ().getDirection ();
133126 ray_type nee_ray;
134127 nee_ray.init (origin, direction);
135- nee_ray.template initInteraction <anisotropic_interaction_type>(interaction);
128+ nee_ray.template setInteraction <anisotropic_interaction_type>(interaction);
136129 nee_ray.setT (t);
137130 tolerance_method_type::template adjust<ray_type>(nee_ray, direction, depth);
138131 if (getLuma (neeContrib.quotient) > lumaContributionThreshold)
@@ -143,6 +136,7 @@ struct Unidirectional
143136 // sample BSDF
144137 scalar_type bxdfPdf;
145138 vector3_type bxdfSample;
139+ vector3_type throughput = ray.getPayloadThroughput ();
146140 {
147141 anisocache_type _cache;
148142 sample_type bsdf_sample = materialSystem.generate (matID, interaction, eps1, _cache);
@@ -163,13 +157,13 @@ struct Unidirectional
163157 {
164158 scalar_type otherTechniqueHeuristic = neeProbability / bxdfPdf; // numerically stable, don't touch
165159 assert (!hlsl::isinf (otherTechniqueHeuristic));
166- ray.setPayloadMISWeights (throughput, otherTechniqueHeuristic * otherTechniqueHeuristic);
160+ ray.updateThroughputAndMISWeights (throughput, otherTechniqueHeuristic * otherTechniqueHeuristic);
167161
168162 // trace new ray
169163 vector3_type origin = intersectP;
170164 vector3_type direction = bxdfSample;
171165 ray.init (origin, direction);
172- ray.template initInteraction <anisotropic_interaction_type>(interaction);
166+ ray.template setInteraction <anisotropic_interaction_type>(interaction);
173167 ray.setT (1.0 /*kSceneSize*/ );
174168 tolerance_method_type::template adjust<ray_type>(ray, direction, depth);
175169
@@ -203,7 +197,7 @@ struct Unidirectional
203197
204198 continuePath = intersection.foundHit ();
205199 if (continuePath)
206- continuePath & = closestHitProgram (d, sampleIndex, ray, intersection);
200+ continuePath = closestHitProgram (d, sampleIndex, ray, intersection);
207201 }
208202 if (!continuePath)
209203 missProgram (ray);
0 commit comments