-
Notifications
You must be signed in to change notification settings - Fork 267
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
Krisrst/advanced lenses #596
Open
krisrst
wants to merge
13
commits into
mitsuba-renderer:master
Choose a base branch
from
krisrst:krisrst/advanced_lenses
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
c285f25
to
b1c9a79
Compare
Hello, this is quite interesting and would love to follow up on this topic. |
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.
This PR is a work-in-progress. As of right now this is not ready for "detailed reviewing" - although general feedback is very much appreciated. There are unimplemented methods, logging of rays to csv files, some very hacky solutions, and files that should not go into mitsuba2 master, that I have used "just to prove that this can be done" - this will be fixed as I go. However, at the current stage the development suffices for a basic demonstration.
The goal of this PR is to realize more complex lens simulations that go beyond the basic "thinlens" and "pinhole" camera models. This can be used to evaluate or even optimize lens designs, for example in terms of distortion. This PR introduces three new components to Mitsuba2:
[1] Schuhmann, Rainer. "Description of aspheric surfaces." Advanced Optical Technologies 8.3-4 (2019): 267-278.
These components can be used to setup a simple biconvex lens:
The following figure shows a subsampled collection of points where the shapes detect origin rays and intersections through the lens housing:
We can experiment with the lens parameters to verify that it behaves "physically". For example, in this figure, we regulate the radius of the circle that the "startlens" shoots rays into. This effectively varies the aperture of the sensor, which is normally done with some physical obstruction between the lens and the sensor (but we can fake that like this):
We see that the lens focuses well with an aperture between 0.5 and 2.5.
In the following figure, we vary the focal length of the system; i.e. the distance between the lens and the sensor:
Where we can see that "optimal" focus is at approximately 47 mm from the first lens. Outside of this region, the image blurs because the rays no longer hit the focal point of the lens system.
A single high resolution image of the rendered scene:
![image](https://user-images.githubusercontent.com/91314077/168026293-3f5f3767-08ab-42fd-86de-8ed3f11aa952.png)
**Compiling / Testing **
Mitsuba.conf
The "main test script" is located in a temporary folder "temp/test.xml". It reuses parts from the
cbox-rgb.xml
script. To run the demo:/build/dist/mitsuba -D flen=47.0 -D fov=4 -D aperture=12.5 -D res=256 -D spp=128 -D max_depth=12 -m scalar_rgb -o test temp/test.xml -t 16 2> /dev/null
At the time of writing I use the
stderr
file descriptor to subsample ray points etc. Any suggestions on alternative ways to "debug rays" is very welcome.ToDo List
Please add the labels (e.g. bug, feature, ..) corresponding to this PR
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
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