Misc cleanup of aspheric_surf code#1
Open
jtkornel wants to merge 8 commits intokrisrst:krisrst/advanced_lensesfrom
Open
Misc cleanup of aspheric_surf code#1jtkornel wants to merge 8 commits intokrisrst:krisrst/advanced_lensesfrom
jtkornel wants to merge 8 commits intokrisrst:krisrst/advanced_lensesfrom
Conversation
Enoki offers a template which rewrites it to x*x, used by other plugins Main reason is that the expressions become a bit simpler and readable This may use a little less compute resources if it avoids a function call (did not see any significant change with gpu_rgb profile)
The radius parameter was useful for the basic shapes like cylinder and sphere to scale it from unit size, but with more fine control of the geometry through other parameters it is not necessary. Also arbitrary scaling through the m_to_world transform can destroy assumptions in the geometry calculations so do not allow that, require that scaling is an identity matrix. Translation and translation through the m_to_world transform is still allowed and useful (but rotation may need a bit of fixing)
This gives a nice speedup from 19s to 13.3s with the GPU backend on my machine BEFORE 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/asphsurf.so" .. Update AsphSurf using flip=false inv_norm=false kappa=0.00 radius=172.00 (rho=0.005814) hlim=12.70 zlim=0.47 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/cylhollow.so" .. 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/diffuse.so" .. 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/uniform.so" .. Update AsphSurf using flip=true inv_norm=false kappa=0.00 radius=30.06 (rho=0.033267) hlim=12.70 zlim=2.81 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/obj.so" .. 2022-07-20 15:19:55 INFO main [PluginManager] Loading plugin "plugins/area.so" .. 2022-07-20 15:19:55 INFO main [Scene] Building scene in OptiX .. 2022-07-20 15:19:55 INFO main [SamplingIntegrator] Start rendering... 2022-07-20 15:20:14 INFO main [SamplingIntegrator] Rendering finished. (took 19.067s) 2022-07-20 15:20:14 INFO main [HDRFilm] ✔ Developing "test.exr" .. 2022-07-20 15:20:14 INFO main [Profiler] Recorded 1954 samples, used 11/256 hash table entries. 2022-07-20 15:20:14 INFO main [Profiler] ⏱ Profile (hierarchical): 2022-07-20 15:20:14 INFO main [Profiler] Idle 2.00% 2022-07-20 15:20:14 INFO main [Profiler] Integrator::render() 97.70% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::sample_ray() 0.05% 2022-07-20 15:20:14 INFO main [Profiler] ImageBlock::put() 0.26% 2022-07-20 15:20:14 INFO main [Profiler] SamplingIntegrator::sample() 97.39% 2022-07-20 15:20:14 INFO main [Profiler] BSDF::eval(), pdf() 0.10% 2022-07-20 15:20:14 INFO main [Profiler] BSDF::sample() 0.20% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::eval(), pdf() 0.05% 2022-07-20 15:20:14 INFO main [Profiler] Scene::ray_intersect() 16.17% 2022-07-20 15:20:14 INFO main [Profiler] Scene::sample_emitter_direction() 8.96% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::sample_direction() 0.20% 2022-07-20 15:20:14 INFO main [Profiler] Scene::ray_test() 8.75% 2022-07-20 15:20:14 INFO main [Profiler] Scene initialization 0.31% 2022-07-20 15:20:14 INFO main [Profiler] ⏱ Profile (flat): 2022-07-20 15:20:14 INFO main [Profiler] SamplingIntegrator::sample() 71.90% 2022-07-20 15:20:14 INFO main [Profiler] Scene::ray_intersect() 16.17% 2022-07-20 15:20:14 INFO main [Profiler] Scene::ray_test() 8.75% 2022-07-20 15:20:14 INFO main [Profiler] Idle 2.00% 2022-07-20 15:20:14 INFO main [Profiler] Scene initialization 0.31% 2022-07-20 15:20:14 INFO main [Profiler] ImageBlock::put() 0.26% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::sample_direction() 0.20% 2022-07-20 15:20:14 INFO main [Profiler] BSDF::sample() 0.20% 2022-07-20 15:20:14 INFO main [Profiler] BSDF::eval(), pdf() 0.10% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::sample_ray() 0.05% 2022-07-20 15:20:14 INFO main [Profiler] Endpoint::eval(), pdf() 0.05% AFTER Update AsphSurf using flip=false inv_norm=false kappa=0.00 radius=172.00 (rho=0.005814) hlim=12.70 zlim=0.47 2022-07-20 15:45:44 INFO main [PluginManager] Loading plugin "plugins/cylhollow.so" .. 2022-07-20 15:45:44 INFO main [PluginManager] Loading plugin "plugins/diffuse.so" .. 2022-07-20 15:45:44 INFO main [PluginManager] Loading plugin "plugins/uniform.so" .. Update AsphSurf using flip=true inv_norm=false kappa=0.00 radius=30.06 (rho=0.033267) hlim=12.70 zlim=2.81 2022-07-20 15:45:44 INFO main [PluginManager] Loading plugin "plugins/obj.so" .. 2022-07-20 15:45:44 INFO main [PluginManager] Loading plugin "plugins/area.so" .. 2022-07-20 15:45:44 INFO main [Scene] Building scene in OptiX .. 2022-07-20 15:45:44 INFO main [SamplingIntegrator] Start rendering... 2022-07-20 15:45:58 INFO main [SamplingIntegrator] Rendering finished. (took 13.28s) 2022-07-20 15:45:58 INFO main [HDRFilm] ✔ Developing "test.exr" .. 2022-07-20 15:45:58 INFO main [Profiler] Recorded 1362 samples, used 10/256 hash table entries. 2022-07-20 15:45:58 INFO main [Profiler] ⏱ Profile (hierarchical): 2022-07-20 15:45:58 INFO main [Profiler] Idle 2.35% 2022-07-20 15:45:58 INFO main [Profiler] Integrator::render() 97.28% 2022-07-20 15:45:58 INFO main [Profiler] ImageBlock::put() 0.51% 2022-07-20 15:45:58 INFO main [Profiler] SamplingIntegrator::sample() 96.77% 2022-07-20 15:45:58 INFO main [Profiler] BSDF::eval(), pdf() 0.15% 2022-07-20 15:45:58 INFO main [Profiler] BSDF::sample() 0.07% 2022-07-20 15:45:58 INFO main [Profiler] Scene::ray_intersect() 22.32% 2022-07-20 15:45:58 INFO main [Profiler] Scene::sample_emitter_direction() 12.04% 2022-07-20 15:45:58 INFO main [Profiler] Endpoint::sample_direction() 0.29% 2022-07-20 15:45:58 INFO main [Profiler] Scene::ray_test() 11.60% 2022-07-20 15:45:58 INFO main [Profiler] Scene initialization 0.37% 2022-07-20 15:45:58 INFO main [Profiler] ⏱ Profile (flat): 2022-07-20 15:45:58 INFO main [Profiler] SamplingIntegrator::sample() 62.19% 2022-07-20 15:45:58 INFO main [Profiler] Scene::ray_intersect() 22.32% 2022-07-20 15:45:58 INFO main [Profiler] Scene::ray_test() 11.60% 2022-07-20 15:45:58 INFO main [Profiler] Idle 2.35% 2022-07-20 15:45:58 INFO main [Profiler] ImageBlock::put() 0.51% 2022-07-20 15:45:58 INFO main [Profiler] Scene initialization 0.37% 2022-07-20 15:45:58 INFO main [Profiler] Endpoint::sample_direction() 0.29% 2022-07-20 15:45:58 INFO main [Profiler] BSDF::eval(), pdf() 0.15% 2022-07-20 15:45:58 INFO main [Profiler] Scene::sample_emitter_direction() 0.15% 2022-07-20 15:45:58 INFO main [Profiler] BSDF::sample() 0.07%
Remove the special case handling for curvature flipping Now allow curvature flipping by using negative radius values which is common in optics specs. The flip flag is still kept working. Surface normals always pointing in the negative z-direction by default Surface normals must therefore be flipped for "exit surfaces" facing right
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please add the labels (e.g. bug, feature, ..) corresponding to this PR
Description
I have also independently verified that the intersection formula was/is correct. But for hyperbolic surfaces (kappa < 0) the boxing of the lens surface (currently named point_on_lens_surface) has not been tight enough because there is a mirror hyperbola on the other side of the origin along z, thus another z bound is needed. Will do fix in another PR.
Fixes # (issue)
Testing
Please describe the tests that you added to verify your changes.
Checklist:
Please make sure to complete this checklist before requesting a review.
gpu_*andpacket_*variants. If you can't test this, please leave below