Skip to content

Remainder from hlsl PT and stuff moved out of bxdf unit test#980

Merged
devshgraphicsprogramming merged 26 commits intomasterfrom
minor_adjustments_to_bxdf_and_path_tracing_stuff
Feb 12, 2026
Merged

Remainder from hlsl PT and stuff moved out of bxdf unit test#980
devshgraphicsprogramming merged 26 commits intomasterfrom
minor_adjustments_to_bxdf_and_path_tracing_stuff

Conversation

@keptsecret
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread include/nbl/builtin/hlsl/math/quadrature/adaptive_simpson.hlsl Outdated
Comment thread include/nbl/builtin/hlsl/math/quadrature/adaptive_simpson.hlsl Outdated
Comment thread include/nbl/builtin/hlsl/visualization/turbo.hlsl Outdated
Comment thread include/nbl/builtin/hlsl/visualization/turbo.hlsl Outdated
@keptsecret
Copy link
Copy Markdown
Contributor Author

hlsl/matrix_utils/transformation_matrix_utils.hlsl removed because of https://github.com/Devsh-Graphics-Programming/Nabla/pull/966/files#r2618467323

Comment on lines 203 to +207
const scalar_type NdotL = hlsl::mix(scalar_type(2.0) * VdotH * localH.z - NdotV,
localH.z * (VdotH * rcpEta.value[0] + LdotH) - NdotV * rcpEta.value[0], transmitted);
// VNDF sampling guarantees that `VdotH` has same sign as `NdotV`
// and `transmitted` controls the sign of `LdotH` relative to `VdotH` by construction (reflect -> same sign, or refract -> opposite sign)
if (ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
if (hlsl::isnan(NdotL) || ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
Copy link
Copy Markdown
Member

@devshgraphicsprogramming devshgraphicsprogramming Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is it possible for you to get a NaN NdotL ?

VdotH, localH.z or what else is nan beforehand?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the NAN can only come from here

const scalar_type LdotH = hlsl::mix(VdotH, ieee754::copySign(hlsl::sqrt(rcpEta.value2[0]*VdotH*VdotH + scalar_type(1.0) - rcpEta.value2[0]), -VdotH), transmitted);

and thats where you should detect and bail from, so you:

  1. save yourself computing NdotL here
  2. doing this NaN check for BRDFs (affects only BSDFs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can asset that NdotL is not NaN just before the If though.

@devshgraphicsprogramming devshgraphicsprogramming merged commit 295205e into master Feb 12, 2026
19 checks passed
@devshgraphicsprogramming devshgraphicsprogramming deleted the minor_adjustments_to_bxdf_and_path_tracing_stuff branch February 12, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants