Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
83e30e4
Merge branch 'master' into ris_bxdfs
keptsecret Mar 20, 2026
067d107
change concepts for bxdf to *_and_weight methods, make changes for co…
keptsecret Mar 20, 2026
fc6deb8
pdf method renamed to denominator, don't expect to be used
keptsecret Mar 20, 2026
f2e2265
camelcase method names, no need for denominator method (pdf is pdf an…
keptsecret Mar 23, 2026
0708859
refactor cook torrance to fit concept
keptsecret Mar 23, 2026
63cd4df
changes to method names in pt concept, use *_weight instead of pdf an…
keptsecret Mar 23, 2026
a877934
renamed pdf to forwardPdf
keptsecret Mar 23, 2026
64ce3ba
add tractable pdf trait to bxdfs
keptsecret Mar 23, 2026
148b9bd
bxdf input random to generate has variable dimensions (brdf>=2; bsdf>…
keptsecret Mar 23, 2026
95a3862
merge master, fix conflicts
keptsecret Mar 24, 2026
946c9c7
pass ray to nee generate instead, store depth in ray
keptsecret Mar 24, 2026
4f4421d
nee deferredPdf is deferredWeight
keptsecret Mar 24, 2026
a70f420
all bxdfs have a cache type from generate to quotient_weight, microfa…
keptsecret Mar 24, 2026
dab4a18
eval should have its own cache type in concepts
keptsecret Mar 24, 2026
fb878a6
minor typo bug fixes
keptsecret Mar 25, 2026
4171059
eval returns a value_and_weight type, fixed some bugs in bxdf concept
keptsecret Mar 25, 2026
0e16279
made value_and_pdf compose from value_and_weight
keptsecret Mar 25, 2026
345865f
reuse quant query and other stuff from forwardPdf in quotient and eva…
keptsecret Mar 25, 2026
a98cd45
reuse reflectance from forwardpdf in eval
keptsecret Mar 25, 2026
d0ed7d3
renamed quotient_pdf type to quotient_weight type
keptsecret Mar 26, 2026
110547a
minor fixes to cook torrance, removed redundant functions
keptsecret Mar 26, 2026
ef9156e
only microfacet bxdfs need eval cache type, allow for overload with e…
keptsecret Mar 26, 2026
05124c2
latest example
keptsecret Mar 26, 2026
efa17ca
latest example
keptsecret Mar 27, 2026
bea4780
minor changes to concepts, microfacet bxdfs have eval that autogenera…
keptsecret Mar 27, 2026
7d27081
added additional checks for a=0 to get pdf=inf
keptsecret Mar 27, 2026
d8271b9
regular bxdfs also have eval that don't need cache as input param
keptsecret Mar 27, 2026
e4a8319
regular bxdfs don't take cache for eval
keptsecret Mar 27, 2026
920c44a
latest example
keptsecret Mar 27, 2026
52228ca
use isinf because don't need to look out for NaNs
keptsecret Mar 31, 2026
f11902b
there was a bug in `decode_before_scramble_helper`
devshgraphicsprogramming Mar 30, 2026
5efa330
check pdf for NaN as well to reduce BSDF flickering, still not entire…
keptsecret Apr 1, 2026
3082d9e
latest example
keptsecret Apr 1, 2026
9076efb
fix fresnel iridescent not doing transmission
keptsecret Apr 2, 2026
6c49c99
check for nan not required after fixing path tracer
keptsecret Apr 3, 2026
ff9321e
removed cache from lambertian eval that forgot to remove
keptsecret Apr 6, 2026
b49e590
merge master, fix conflicts
keptsecret Apr 17, 2026
bb63a41
update submodules that was incorrectly regressed
keptsecret Apr 17, 2026
b31b8b6
fix to lambertian quotient_weight using wrong pdf
keptsecret Apr 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-nabla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ jobs:
$imageBadge | Set-Content -Path "$imagePath/image-badge.json" -Encoding utf8

- name: Deploy Badges
uses: Devsh-Graphics-Programming/actions-gh-pages@v4.0.0-devsh.1
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: badges
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/boost/superproject
Submodule superproject updated 1 files
+1 −1 libs/wave
3 changes: 3 additions & 0 deletions include/nbl/asset/utils/IShaderCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "nbl/builtin/hlsl/enums.hlsl"

#include <functional>

namespace nbl::asset
{

Expand Down Expand Up @@ -136,6 +138,7 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
E_SPIRV_VERSION targetSpirvVersion = E_SPIRV_VERSION::ESV_1_6;
bool depfile = false;
system::path depfilePath = {};
std::function<void(std::string_view)> onPartialOutputOnFailure = {};
};

// https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#debugging
Expand Down
22 changes: 12 additions & 10 deletions include/nbl/builtin/hlsl/bxdf/base/lambertian.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ struct SLambertianBase

NBL_CONSTEXPR_STATIC_INLINE BxDFClampMode _clamp = conditional_value<IsBSDF, BxDFClampMode, BxDFClampMode::BCM_ABS, BxDFClampMode::BCM_MAX>::value;

spectral_type eval(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type eval_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return hlsl::promote<spectral_type>(_sample.getNdotL(_clamp) * numbers::inv_pi<scalar_type> * hlsl::mix(1.0, 0.5, IsBSDF));
const spectral_type quo = hlsl::promote<spectral_type>(_sample.getNdotL(_clamp) * numbers::inv_pi<scalar_type> * hlsl::mix(1.0, 0.5, IsBSDF));
return quotient_pdf_type::create(quo, denominator(_sample, interaction));
}
spectral_type eval(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type eval_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return eval(_sample, interaction.isotropic);
return eval_and_weight(_sample, interaction.isotropic);
}

template<typename C=bool_constant<!IsBSDF> >
Expand Down Expand Up @@ -62,19 +63,20 @@ struct SLambertianBase
return generate(anisotropic_interaction_type::create(interaction), u);
}

scalar_type pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
// pdf function, because this BxDF has a tractable pdf, indicates that eval weight is also pdf
scalar_type denominator(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
Comment thread
devshgraphicsprogramming marked this conversation as resolved.
Outdated
{
NBL_IF_CONSTEXPR (IsBSDF)
return sampling::ProjectedSphere<scalar_type>::pdf(_sample.getNdotL(_clamp));
else
return sampling::ProjectedHemisphere<scalar_type>::pdf(_sample.getNdotL(_clamp));
}
scalar_type pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
scalar_type denominator(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return pdf(_sample, interaction.isotropic);
return denominator(_sample, interaction.isotropic);
}

quotient_pdf_type quotient_and_pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type quotient_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
sampling::quotient_and_pdf<monochrome_type, scalar_type> qp;
NBL_IF_CONSTEXPR (IsBSDF)
Expand All @@ -83,9 +85,9 @@ struct SLambertianBase
qp = sampling::ProjectedHemisphere<scalar_type>::template quotientAndPdf(_sample.getNdotL(_clamp));
return quotient_pdf_type::create(qp.quotient()[0], qp.pdf());
}
quotient_pdf_type quotient_and_pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type quotient_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return quotient_and_pdf(_sample, interaction.isotropic);
return quotient_and_weight(_sample, interaction.isotropic);
}
};

Expand Down
27 changes: 14 additions & 13 deletions include/nbl/builtin/hlsl/bxdf/base/oren_nayar.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ struct SOrenNayarBase
return hlsl::promote<spectral_type>(NdotL * numbers::inv_pi<scalar_type> * hlsl::mix(1.0, 0.5, IsBSDF) * __rec_pi_factored_out_wo_clamps(query.getVdotL(), NdotL, interaction.getNdotV(_clamp)));
}

spectral_type eval(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type eval_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
SQuery query;
query.VdotL = hlsl::dot(interaction.getV().getDirection(), _sample.getL().getDirection());
return __eval<SQuery>(query, _sample, interaction);
return quotient_pdf_type::create(__eval<SQuery>(query, _sample, interaction), denominator(_sample, interaction));
}
spectral_type eval(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type eval_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return eval(_sample, interaction.isotropic);
return eval_and_weight(_sample, interaction.isotropic);
}

template<typename C=bool_constant<!IsBSDF> >
Expand Down Expand Up @@ -97,34 +97,35 @@ struct SOrenNayarBase
return generate(anisotropic_interaction_type::create(interaction), u);
}

scalar_type pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
// pdf function, because this BxDF has a tractable pdf
scalar_type denominator(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
if (IsBSDF)
return sampling::ProjectedSphere<scalar_type>::pdf(_sample.getNdotL(_clamp));
else
return sampling::ProjectedHemisphere<scalar_type>::pdf(_sample.getNdotL(_clamp));
}
scalar_type pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
scalar_type denominator(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return pdf(_sample, interaction.isotropic);
return denominator(_sample, interaction.isotropic);
}

template<typename Query>
quotient_pdf_type __quotient_and_pdf(NBL_CONST_REF_ARG(Query) query, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type __quotient_and_weight(NBL_CONST_REF_ARG(Query) query, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
scalar_type _pdf = pdf(_sample, interaction);
scalar_type _pdf = denominator(_sample, interaction);
scalar_type q = __rec_pi_factored_out_wo_clamps(query.getVdotL(), _sample.getNdotL(_clamp), interaction.getNdotV(_clamp));
return quotient_pdf_type::create(q, _pdf);
}
quotient_pdf_type quotient_and_pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type quotient_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
SQuery query;
query.VdotL = hlsl::dot(interaction.getV().getDirection(), _sample.getL().getDirection());
return __quotient_and_pdf<SQuery>(query, _sample, interaction);
return __quotient_and_weight<SQuery>(query, _sample, interaction);
}
quotient_pdf_type quotient_and_pdf(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
quotient_pdf_type quotient_and_weight(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) NBL_CONST_MEMBER_FUNC
{
return quotient_and_pdf(_sample, interaction.isotropic);
return quotient_and_weight(_sample, interaction.isotropic);
}

scalar_type A2;
Expand Down
Loading
Loading