-
Notifications
You must be signed in to change notification settings - Fork 17
Ris bxdfs example refactor #261
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e106cd0
Merge branch 'master' into ris_bxdfs
keptsecret dcac12e
refactor changes in method names in concepts
keptsecret ebb025b
Merge branch 'master' into ris_bxdfs
keptsecret 4da04ee
fixes from changes to projected solid angle tri
keptsecret 25e2b43
ray stores depth, nee gets depth from ray
keptsecret b2a0938
nee deferredPdf is deferredWeight
keptsecret 770899c
refactor bxdfs have cache type
keptsecret 8694bdd
fixes to bxdf unit tests
keptsecret 4bdd81c
refactor eval returns value_and_weight type
keptsecret 5d53317
refactor eval use value_and_weight type
keptsecret 789a88c
refactor use quotient_weight type
keptsecret ee0c4ab
merge master
keptsecret 89eb0fa
change remaining method names with pdf to weight
keptsecret 88a01d2
avoid division by 0
keptsecret 5d64bab
refactor regular bxdf don't take cache for eval
keptsecret 9b5cbc3
fix change in owen sampler
keptsecret bd79b76
fixes some flickering by constraining scramblebuf coord
keptsecret b72cc0f
avoid creating pathtracer struct every loop for persistent wg mode
keptsecret f17d9ac
flip intersect normals when intersect from backface, adjust tolerance…
keptsecret 21334ea
merge master, fix conflicts (except render.comp.hlsl needs modificati…
keptsecret 2065829
move changes to render.comp.hlsl to new merge
keptsecret File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,8 @@ struct MaterialSystem | |
| using measure_type = typename DiffuseBxDF::spectral_type; | ||
| using sample_type = typename DiffuseBxDF::sample_type; | ||
| using ray_dir_info_type = typename sample_type::ray_dir_info_type; | ||
| using quotient_pdf_type = typename DiffuseBxDF::quotient_pdf_type; | ||
| using quotient_weight_type = typename DiffuseBxDF::quotient_weight_type; | ||
| using value_weight_type = typename DiffuseBxDF::value_weight_type; | ||
| using anisotropic_interaction_type = typename DiffuseBxDF::anisotropic_interaction_type; | ||
| using isotropic_interaction_type = typename anisotropic_interaction_type::isotropic_interaction_type; | ||
| using anisocache_type = typename ConductorBxDF::anisocache_type; | ||
|
|
@@ -133,34 +134,36 @@ struct MaterialSystem | |
| } | ||
| } | ||
|
|
||
| measure_type eval(material_id_type matID, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) | ||
| value_weight_type evalAndWeight(material_id_type matID, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction) | ||
| { | ||
| cache_type _cache = getCacheFromSampleInteraction(matID, _sample, interaction); | ||
| MaterialType matType = (MaterialType)bxdfs[matID.id].materialType; | ||
| switch(matType) | ||
| { | ||
| case MaterialType::DIFFUSE: | ||
| { | ||
| return bxdfs[matID.id].albedo * _cache.diffuseBxDF.eval(_sample, interaction.isotropic); | ||
| value_weight_type ret = _cache.diffuseBxDF.evalAndWeight(_sample, interaction.isotropic); | ||
| ret._value *= bxdfs[matID.id].albedo; | ||
| return ret; | ||
| } | ||
| case MaterialType::CONDUCTOR: | ||
| { | ||
| return _cache.conductorBxDF.eval(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.conductorBxDF.evalAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::DIELECTRIC: | ||
| { | ||
| return _cache.dielectricBxDF.eval(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.dielectricBxDF.evalAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::IRIDESCENT_CONDUCTOR: | ||
| { | ||
| return _cache.iridescentConductorBxDF.eval(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.iridescentConductorBxDF.evalAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::IRIDESCENT_DIELECTRIC: | ||
| { | ||
| return _cache.iridescentDielectricBxDF.eval(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.iridescentDielectricBxDF.evalAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| default: | ||
| return hlsl::promote<measure_type>(0.0); | ||
| return value_weight_type::create(0.0, 0.0); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -172,7 +175,8 @@ struct MaterialSystem | |
| { | ||
| case MaterialType::DIFFUSE: | ||
| { | ||
| return _cache.diffuseBxDF.generate(interaction, u.xy); | ||
| typename diffuse_op_type::isocache_type dummycache; | ||
| return _cache.diffuseBxDF.generate(interaction, u.xy, dummycache); | ||
| } | ||
| case MaterialType::CONDUCTOR: | ||
| { | ||
|
|
@@ -230,7 +234,7 @@ struct MaterialSystem | |
| } | ||
| } | ||
|
|
||
| quotient_pdf_type quotient_and_pdf(material_id_type matID, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction, NBL_REF_ARG(cache_type) _cache) | ||
| quotient_weight_type quotientAndWeight(material_id_type matID, NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction, NBL_REF_ARG(cache_type) _cache) | ||
| { | ||
| const float minimumProjVectorLen = 0.00000001; // TODO: still need this check? | ||
| if (interaction.getNdotV(bxdf::BxDFClampMode::BCM_ABS) > minimumProjVectorLen && _sample.getNdotL(bxdf::BxDFClampMode::BCM_ABS) > minimumProjVectorLen) | ||
|
|
@@ -240,31 +244,32 @@ struct MaterialSystem | |
| { | ||
| case MaterialType::DIFFUSE: | ||
| { | ||
| quotient_pdf_type ret = _cache.diffuseBxDF.quotient_and_pdf(_sample, interaction.isotropic); | ||
| typename diffuse_op_type::isocache_type dummycache; | ||
| quotient_weight_type ret = _cache.diffuseBxDF.quotientAndWeight(_sample, interaction.isotropic, dummycache); | ||
|
Comment on lines
+247
to
+248
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leave comment why |
||
| ret._quotient *= bxdfs[matID.id].albedo; | ||
| return ret; | ||
| } | ||
| case MaterialType::CONDUCTOR: | ||
| { | ||
| return _cache.conductorBxDF.quotient_and_pdf(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.conductorBxDF.quotientAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::DIELECTRIC: | ||
| { | ||
| return _cache.dielectricBxDF.quotient_and_pdf(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.dielectricBxDF.quotientAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::IRIDESCENT_CONDUCTOR: | ||
| { | ||
| return _cache.iridescentConductorBxDF.quotient_and_pdf(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.iridescentConductorBxDF.quotientAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| case MaterialType::IRIDESCENT_DIELECTRIC: | ||
| { | ||
| return _cache.iridescentDielectricBxDF.quotient_and_pdf(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| return _cache.iridescentDielectricBxDF.quotientAndWeight(_sample, interaction.isotropic, _cache.aniso_cache.iso_cache); | ||
| } | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
| return quotient_pdf_type::create(hlsl::promote<measure_type>(0.0), 0.0); | ||
| return quotient_weight_type::create(0.0, 0.0); | ||
| } | ||
|
|
||
| bool hasEmission(material_id_type matID) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the cache to test the functions without the special overload