Skip to content

Hlsl bxdfs 3 #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 232 commits into
base: master
Choose a base branch
from
Open

Hlsl bxdfs 3 #899

wants to merge 232 commits into from

Conversation

devshgraphicsprogramming
Copy link
Member

Description

Continuing #811 due to GH UI messing up diffs again

Testing

TODO list:

Comment on lines 202 to 204
scalar_type a2 = A*A;
ndf::Beckmann<scalar_type, false> beckmann_ndf;
beckmann_ndf.a2 = a2;
Copy link
Member Author

Choose a reason for hiding this comment

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

why are you storing A as a member when you could store the parametrized NDF instead ?

btw seems that CookTorrance is a good idea as there's really not much difference between GGX and beckmann BRDF and BTDF

}

scalar_type A;
spectral_type ior0, ior1;
Copy link
Member Author

Choose a reason for hiding this comment

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

why store ior instead of oriented Etas ?

Copy link
Contributor

Choose a reason for hiding this comment

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

The values of ior are used directly in fresnel::Conductor, but OrientedEtas not used anywhere in beckmann brdf.

Comment on lines 88 to 135
Scalar getTdotL2() NBL_CONST_MEMBER_FUNC { return _sample.getTdotL2(); }
Scalar getBdotL2() NBL_CONST_MEMBER_FUNC { return _sample.getBdotL2(); }
Scalar getTdotV2() NBL_CONST_MEMBER_FUNC { return interaction.getTdotV2(); }
Scalar getBdotV2() NBL_CONST_MEMBER_FUNC { return interaction.getBdotV2(); }
Scalar getTdotH2() NBL_CONST_MEMBER_FUNC { return cache.getTdotH2(); }
Scalar getBdotH2() NBL_CONST_MEMBER_FUNC { return cache.getBdotH2(); }

LS _sample;
SI interaction;
MC cache;
BxDFClampMode _clamp;
};

template<class LS, class Iso, class Aniso, class IsoCache, class AnisoCache, class Spectrum NBL_PRIMARY_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Iso> && surface_interactions::Anisotropic<Aniso> && CreatableIsotropicMicrofacetCache<IsoCache> && AnisotropicMicrofacetCache<AnisoCache>)
struct SGGXBxDF
template<typename T>
struct SGGXDG1Query
{
using this_t = SGGXBxDF<LS, Iso, Aniso, IsoCache, AnisoCache, Spectrum>;
using scalar_type = typename LS::scalar_type;
using ray_dir_info_type = typename LS::ray_dir_info_type;
using scalar_type = T;

scalar_type getNdf() NBL_CONST_MEMBER_FUNC { return ndf; }
scalar_type getG1over2NdotV() NBL_CONST_MEMBER_FUNC { return G1_over_2NdotV; }

scalar_type ndf;
scalar_type G1_over_2NdotV;
};

template<class Config NBL_STRUCT_CONSTRAINABLE>
struct SGGXAnisotropicBxDF;

template<class Config NBL_PRIMARY_REQUIRES(config_concepts::MicrofacetConfiguration<Config>)
struct SGGXIsotropicBxDF
{
using this_t = SGGXIsotropicBxDF<Config>;
using scalar_type = typename Config::scalar_type;
using vector2_type = vector<scalar_type, 2>;
using vector3_type = vector<scalar_type, 3>;
using matrix2x3_type = matrix<scalar_type,3,2>;
using ray_dir_info_type = typename Config::ray_dir_info_type;

using isotropic_interaction_type = Iso;
using anisotropic_interaction_type = Aniso;
using sample_type = LS;
using spectral_type = Spectrum;
using isotropic_interaction_type = typename Config::isotropic_interaction_type;
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using isocache_type = IsoCache;
using anisocache_type = AnisoCache;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;

using params_isotropic_t = GGXParams<LS, Iso, IsoCache, scalar_type>;
using params_anisotropic_t = GGXParams<LS, Aniso, AnisoCache, scalar_type>;
using params_isotropic_t = GGXParams<sample_type, isotropic_interaction_type, isocache_type, scalar_type>;
using params_anisotropic_t = GGXParams<sample_type, anisotropic_interaction_type, anisocache_type, scalar_type>;
Copy link
Member Author

Choose a reason for hiding this comment

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

similar insights as Beckmann

return quotient_pdf_type::create(hlsl::promote<spectral_type>(quo), _pdf);
}

scalar_type A;
Copy link
Member Author

Choose a reason for hiding this comment

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

why not store the NDF instead of its parameters, also transmission should store orientedEtas

Cook Torrance brdf and bsdf would help a lot here

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