Address path tracer merge leftover comments#991
Conversation
…mek's remove_core_matrix branch, added create from mat3x3
…c cast to/from truncated quat
|
|
include/nbl/builtin/hlsl/sampling/projected_spherical_triangle.hlsl
Outdated
Show resolved
Hide resolved
include/nbl/builtin/hlsl/sampling/projected_spherical_triangle.hlsl
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
most parameters should be members #966 (comment)
There was a problem hiding this comment.
Also #966 (comment)
There was a problem hiding this comment.
for next sampling PR, to rework in line with concepts of #1001
| return retval; | ||
| } | ||
|
|
||
| vector4_type computeBilinearPatch(const vector3_type receiverNormal, bool isBSDF) |
There was a problem hiding this comment.
why is this returning vector4_type instead of sampling::bilinear
There was a problem hiding this comment.
ok sampling PR
| static ProjectedSphericalTriangle<T> create(NBL_CONST_REF_ARG(shapes::SphericalTriangle<T>) tri) | ||
| { | ||
| ProjectedSphericalTriangle<T> retval; | ||
| retval.tri = tri; | ||
| return retval; | ||
| } |
There was a problem hiding this comment.
remove, see #966 (comment)
There was a problem hiding this comment.
ok sampling PR
| vector3_type cos_vertices, sin_vertices; | ||
| const scalar_type solidAngle = tri.solidAngleOfTriangle(cos_vertices, sin_vertices, cos_a, cos_c, csc_b, csc_c); | ||
| const scalar_type solidAngle = tri.solidAngle(cos_vertices, sin_vertices); |
There was a problem hiding this comment.
should be precomputed and stored as members #966 (comment)
There was a problem hiding this comment.
ok sampling PR
There was a problem hiding this comment.
again function with bazillion parameters that are really local members
There was a problem hiding this comment.
ok sampling PR
| // example only uses isotropic bxdfs | ||
| quotient_pdf_type bsdf_quotient_pdf = materialSystem.quotient_and_pdf(matID, nee_sample, interaction.isotropic, _cache.iso_cache); | ||
| neeContrib.quotient *= materialSystem.eval(matID, nee_sample, interaction.isotropic, _cache.iso_cache) * rcpChoiceProb; | ||
| const scalar_type otherGenOverLightAndChoice = bsdf_quotient_pdf.pdf * rcpChoiceProb / neeContrib.pdf; |
There was a problem hiding this comment.
pass full aniso interaction, let the material system deal with only using the isotropic part
Also your PDF is mismatched.
There was a problem hiding this comment.
@keptsecret still using the wrong PDF to pair with eval
…n interaction instead of just isBSDF
| namespace impl | ||
| { | ||
| struct DummyInteraction {}; | ||
| } | ||
|
|
||
| #define NBL_CONCEPT_NAME Ray | ||
| #define NBL_CONCEPT_TPLT_PRM_KINDS (typename) | ||
| #define NBL_CONCEPT_TPLT_PRM_NAMES (T) | ||
| #define NBL_CONCEPT_PARAM_0 (ray, T) | ||
| #define NBL_CONCEPT_PARAM_1 (v, typename T::vector3_type) | ||
| #define NBL_CONCEPT_PARAM_2 (b, bool) | ||
| #define NBL_CONCEPT_PARAM_2 (interaction, impl::DummyInteraction) |
There was a problem hiding this comment.
not sure how an empty struct tests any better than a real default aniso interaction
There was a problem hiding this comment.
I didn't want to include the bxdf/common.hlsl in here.
But could change to surface_interaction::SIsotropic if that's better?
| ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((scene.getNormal(id, intersectP)), ::nbl::hlsl::is_same_v, typename T::vector3_type)) | ||
| ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((scene.template getInteraction<impl::DummyRay>(id, intersectP, ray)), ::nbl::hlsl::is_same_v, typename T::interaction_type)) | ||
| ); | ||
| #undef ray |
There was a problem hiding this comment.
why are you still adamant on the scene giving you an interaction and not the closestHit trace ray of the intersector !?
You do realize that in general thats not possible with a ray, intersection position and an object ID ?
There was a problem hiding this comment.
(well or possible, but you'd need to re-intersect the BLAS just for that)
There was a problem hiding this comment.
The scene already does give a closest hit ray. This is for filling out the interaction member of the closest hit return struct.
Regardless, I've now made the scene handle all of creating the closest hit return struct.
| vector3_type direction = bxdfSample; | ||
| ray.init(origin, direction); | ||
| ray.template initInteraction<anisotropic_interaction_type>(interaction); | ||
| ray.setT(1.0/*kSceneSize*/); |
There was a problem hiding this comment.
huh? why 1.0 ?
There was a problem hiding this comment.
t is used in the Tolerance::adjust function to control ray origin. It was also 1.0 in the glsl version but with the comment kSceneSize, I guess it should be that but not sure how to get it
| quotient_pdf_type bsdf_quotient_pdf = materialSystem.quotient_and_pdf(matID, nee_sample, iso_interaction, _cache.iso_cache); | ||
| neeContrib.quotient *= materialSystem.eval(matID, nee_sample, iso_interaction, _cache.iso_cache) * rcpChoiceProb; |
There was a problem hiding this comment.
material system shall always take aniso interaction
| quotient_pdf_type bsdf_quotient_pdf = materialSystem.quotient_and_pdf(matID, bsdf_sample, interaction.isotropic, _cache.iso_cache); | ||
| quotient_pdf_type bsdf_quotient_pdf = materialSystem.quotient_and_pdf(matID, bsdf_sample, iso_interaction, _cache.iso_cache); |
There was a problem hiding this comment.
material system shall always take aniso interaction
| { | ||
| anisotropic_interaction_type interaction = intersectData.getInteraction(); | ||
| isotropic_interaction_type iso_interaction = interaction.isotropic; | ||
| isotropic_interaction_type iso_interaction = interaction.getIsotropic(); |
There was a problem hiding this comment.
in essence this should be an unused variable and removed
| const vector3_type throughputCIE_Y = hlsl::normalize(spectralTypeToLumaCoeffs * throughput); | ||
| measure_type throughputCIE_Y = spectralTypeToLumaCoeffs * throughput; | ||
| { | ||
| scalar_type sum_throughput = throughputCIE_Y[0]; | ||
| NBL_UNROLL for (uint16_t i = 1; i < vector_traits<measure_type>::Dimension; i++) | ||
| sum_throughput += throughputCIE_Y[i]; | ||
| throughputCIE_Y /= sum_throughput; | ||
| } |
There was a problem hiding this comment.
cool, now this needs to in the interaction
There was a problem hiding this comment.
does this update your thoroughput in the payload as well?
Then rename the function to updateThroughputAndMISWeights
| vector3_type direction = bxdfSample; | ||
| ray.initData(origin, direction, interaction.getN(), isBSDF); | ||
| ray.init(origin, direction); | ||
| ray.template initInteraction<anisotropic_interaction_type>(interaction); |
There was a problem hiding this comment.
setInteraction maybe would be a better name ?
| int32_t PackedRcpLog2BaseAndLog2BaseRoot; | ||
| float32_t BrightSampleLumaBias; |
There was a problem hiding this comment.
why do ou have two members now !?
There was a problem hiding this comment.
Huh? It was always 2 members. Both combined unpack to 4 vars for SSplattingParameters, but since we removed one then it's 1 packed and 1 as is.
| nee_ray.init(origin, direction); | ||
| nee_ray.template initInteraction<anisotropic_interaction_type>(interaction); | ||
| nee_ray.setT(t); | ||
| tolerance_method_type::template adjust<ray_type>(nee_ray, direction, depth); |
There was a problem hiding this comment.
isn't the direction already in the ray ?
you need to give it the geometric normal (not the interaction which has the shading normal) if you want to know why read the PBRT book, but offsetting the origin by geo normal keeps your t modification small, while offsetting along the ray can be potentially unbounded with a surface-grazing ray if you want to not self-intersect
| rayAlive = closestHitProgram(d, sampleIndex, ray, intersection); | ||
| continuePath = intersection.foundHit(); | ||
| if (continuePath) | ||
| continuePath &= closestHitProgram(d, sampleIndex, ray, intersection); |
There was a problem hiding this comment.
you don't even need a &= just a = will do, you're in the if statement, so its already true
| materialSystem, scene, intersectP, interaction, | ||
| isBSDF, eps0, depth | ||
| scene, materialSystem, intersectP, interaction, | ||
| eps0, depth |
There was a problem hiding this comment.
you don't need depth
There was a problem hiding this comment.
depth is used to adjust newRayMaxT inside the nee though?
…e internally to use iso
…rsected ray and gives intersection
Makes changes left from #966