mattferraro / causticsengineering Goto Github PK
View Code? Open in Web Editor NEWThis repo demonstrates generating 3D surface meshes from input images
License: MIT License
This repo demonstrates generating 3D surface meshes from input images
License: MIT License
9 times out of 10, when I run the code, I see output like this:
causticsEngineering % julia create_mesh.jl cat_posing.jpg
-0.7084825184623098
0.9797413140103279
Loss:
Minimum: -0.7084825184623098
Maximum: 0.9797413140103279
(512, 512)
(512, 512)
(512, 512)
6.591187573040844
1.192422233106962
0.09291080010935611
0.0076503943138856835
0.0006274343139272808
5.145908379627362e-5
Convergence reached at step 3328.0 with max_update of 9.976433165049815e-6
Overall min_t:0.9882087086735224
-0.8705387614429418
1.0434134720282262
Loss:
Minimum: -0.8705387614429418
Maximum: 1.0434134720282262
(512, 512)
(512, 512)
(512, 512)
3.3736189059429162
0.6537082038600845
0.09809572805409107
0.0547325150128704
0.051162139277199
0.05086932351347559
0.05084530815605421
0.05084333856013063
0.050843177003521756
0.05084316379427653
Overall min_t:0.4750608801904638
-1.1313385534689124
1.1098316875462115
Loss:
Minimum: -1.1313385534689124
Maximum: 1.1098316875462115
(512, 512)
(512, 512)
(512, 512)
2.5819520332699244
0.5188760642923861
0.09672104006757247
0.06366445053157743
0.06094363912439287
0.060720498158988744
0.06070219718314486
0.06070069625486606
0.06070057315941933
0.06070056305410539
Overall min_t:0.22785528518448867
0.00029296875
div: -4.312328351034622e-5
Have all the divergences
0.3894483656565549
0.20231833167764193
0.124059012168825
0.0790930799778991
0.052047210613660494
0.036055963315667405
0.03205074059894223
0.03046537914099536
0.029400282745299523
0.028763086266614675
0.02837094564435181
0.02813328101987218
0.027989636398846145
0.027902794036071408
0.027850261189980855
0.02781841869539476
0.027799155643885923
0.02778746079170332
0.027780368819212083
0.027776066796648107
0.027773458094809737
0.027771875952155054
0.02777091663889291
0.02777033489090996
0.02776998210226679
Example heights: -47.027921842063016 and -47.027921842063016 and 2.972078157936984
Specs: 513 513 526338 2048 524288 1052672
We now have 526338 valid nodes
We've filled up 524288 triangles
We've filled up 1048576 triangles
But every once in a while, changing absolutely nothing about the code or source image, I see output like this:
julia create_mesh.jl cat_posing.jpg
-0.7084825184623098
0.9797413140103279
Loss:
Minimum: -0.7084825184623098
Maximum: 0.9797413140103279
(512, 512)
(512, 512)
(512, 512)
Convergence reached at step 1.0 with max_update of 0
Overall min_t:10000
NaN
NaN
Loss:
Minimum: NaN
Maximum: NaN
(512, 512)
(512, 512)
(512, 512)
Convergence reached at step 1.0 with max_update of 0
Overall min_t:10000
NaN
NaN
Loss:
Minimum: NaN
Maximum: NaN
(512, 512)
(512, 512)
(512, 512)
Convergence reached at step 1.0 with max_update of 0
Overall min_t:10000
0.00029296875
div: NaN
Have all the divergences
Convergence reached at step 1.0 with max_update of 0
Example heights: NaN and NaN and NaN
Specs: 513 513 526338 2048 524288 1052672
We now have 526338 valid nodes
We've filled up 524288 triangles
We've filled up 1048576 triangles
So the code is definitely not running deterministically. Is it possibly due to some uninitialized values somewhere?
When I change the hardcoded focal length here it doesn't seem to actually affect the optical properties. I've been importing all the meshes into Cinema 4D to render the caustics with redshift and they are always in focus at .2 meters. I managed to change the artifact size with no problems, but adjusting the focal length doesn't seem to work for me. I also read through this post and at one point he mentions a similar thing.
I appreciate all the work you put in on this. I'm not a programmer whatsoever, but it's been cool to play around with regardless and I'd be happy to share the animation I'm working on when I finish it.
Edit: I managed to adjust the focal length by just proportionally scaling the points on the front face along the Z axis myself in Cinema 4D. It's actually faster to do it this way rather than generating a brand new mesh every time. Either way thanks again for putting this project up.
What ideas and formulas are used to implement the FindT function in the code? Why do you want to calculate the time when the area is reduced to 0 and divide by 2? I'm looking forward to your reply. Thank you!
Hello,
Wanting to play around with the gravitational caustic project, i tried to run the program on the default image & a picture of mine. In both ARTIFACTS Appeared. So i guess i'ts not ready for acrylic CNC :) .
I Also barely see a height difference, it only appears when i force it trough scaling the depth. It doesnt Not seem as right as shown in Matt heightmap example made a 3D object.
Also appears when the picture is changed :
that becomes ( and it's turned ).
Last but not least, i can't identify wich variable in wich code to change to define the focal plane distance , anybody knows ? ( i am reffering to the Poisson's equation figure 2.8) :
thank you so much Matt Ferero for sharing your amazing work & thorough explanation.
Lyes
Through the author's code, I can construct the optical surface of any picture, but how to simulate the imaging effect through computer software?
Just a complete Julia newbie here who was amazed with the project.. As titled, I came across the error of "CausticsEngineering (not found in project, manifest or registry)" when I ran: _include("C:\Users\xxxxxx\Desktop\run.jl"). Any idea what I should do now? Thanks in advance!
I'd like to play around with the surface image without running julia.
The code should obviously handle images of any size, not just the hardcoded assumption of 512 x 512. There is no reason the code cannot be made to do that, I just haven't gotten around to it.
brew install julia
.Images
package to my global environment. Then ran julia create_mesh.jl cat_posing.png
. It generates the following .obj model, as seen imported into MeshMixer:Unless I'm missing something, this model doesn't appear to have the desired features that would produce a "magic window". I'd love to help but thought I'd first see if anyone else has had success generating a model successfully.
Repeatably only the first iteration of the Poisson Solver will actually run to convergence of epsilon < 1e-5. Subsequent runs never converge and instead time out with epsilon ~ 0.05.
This probably isn't a huge problem but it indicates a weakness in the solver or a weakness in the conditioning. Perhaps the integral of the loss is no longer equal to zero and just needs to be re-centered?
There is no reason the entire source code needs to live in a single file. Separate out the Mesh utilities including:
into a separate file.
Come on. The distance from the Window to the image plane should not be hardcoded, it should be a CLI parameter. Same with the size (in meters) of the window.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.