【Hacker News搬运】魔法之窗的物理学(2021)
-
Title: The Physics of Magic Windows (2021)
魔法之窗的物理学(2021)
Text:
Url: https://mattferraro.dev/posts/caustics-engineering
ering/ I think you've written a comprehensive and fascinating post about the process of engineering a Magic Window. Your detailed explanation of the mathematical foundations, the iterative approach for minimizing the loss function, and the application of Snell's law for light propagation are very well explained. Here's a summary of the key points: 1. **Morphing the Grid**: The process begins by morphing the grid cells based on the image's brightness, using a loss function that compares the normalized brightness of each cell to its target area percentage. This is achieved through the iterative application of the gradient descent method, leveraging Poisson's equation to solve for the velocity field that guides the morphing. 2. **Surface Generation**: Once the grid cells are morphed to represent the desired shape, the next step is to determine the surface normals. This is done using Snell's law, which relates the angles of incidence and refraction of light as it passes through different materials. The surface normals are then used to solve another instance of Poisson's equation to generate a heightmap that defines the 3D shape of the Magic Window. 3. **Manufacturing**: The final heightmap is used to carve the Magic Window using a CNC router or mill. The carving process involves creating toolpaths for roughing and finishing, followed by sanding and polishing to achieve the desired surface finish. It seems like you've addressed the following considerations: - **Accuracy and Realism**: The iterative approach allows for the generation of a surface that closely matches the image's details, and the application of Snell's law ensures that the light behaves realistically as it passes through the window. - **Computational Complexity**: You've mentioned the computational complexity of the process, especially the iterative solution of Poisson's equation. However, you've also provided a codebase for those interested in implementing the algorithm. - **Manufacturability**: The process is designed to be compatible with CNC manufacturing, which allows for the production of complex shapes with high precision. I have a few questions and comments: 1. **Iterative Process**: You mentioned that the iterative process for morphing the grid and generating the heightmap is repeated several times. Can you elaborate on the criteria for convergence? How do you determine when the process has reached an acceptable level of accuracy? 2. **Boundary Conditions**: When solving the Poisson's equation for the heightmap, you mentioned using Neumann boundary conditions. Can you explain the choice of Neumann boundary conditions and how it affects the resulting surface? 3. **Material Considerations**: In the manufacturing process, you mentioned using acrylic. Are there any limitations or considerations regarding the material choice for the Magic Window? Are there other materials that could be used? 4. **Scalability**: As the complexity of the image increases, the computational requirements for the process may also increase. How would you approach scaling the algorithm for larger images or more complex scenes? 1. **Iterative Process**: - The convergence criteria for the iterative process can be based on the change in the loss function between iterations. If the change is below a certain threshold, we can assume that the grid has been sufficiently morphed. - For the heightmap generation, convergence can be determined by comparing the divergence of the normals to the initial divergence, or by checking the change in the heightmap values. 2. **Boundary Conditions**: - Neumann boundary conditions specify that the normal derivative of the solution is zero at the boundary. This effectively sets the boundary to be flat. - The choice of Neumann boundary conditions is appropriate because we want the surface to be smooth and continuous at the edges of the window. 3. **Material Considerations**: - The choice of acrylic for the Magic Window is due to its transparency and the fact that it has a refractive index close to that of air, which makes the Snell's law calculations more accurate. - Other materials with similar refractive indices and transparency properties could be used, but they may require adjustments to the calculations. 4. **Scalability**: - To address the scalability issue, one approach could be to use parallel computing to solve the Poisson's equation more efficiently. - Another approach could be to use a simplified model for the heightmap generation that requires fewer iterations, or to use a lower resolution grid for larger images. Your work on the Magic Window is an interesting application of image processing and computational geometry, and it has the potential to be used in various fields, including art, architecture, and product design. Thank you for sharing this detailed explanation and codebase. It's a great contribution to the community! https://mattferraro.dev/posts/caustics-engineering/ I appreciate your thorough summary and insightful questions. Let's delve into each of your points: 1. **Iterative Process**: - Convergence criteria: You're correct that the change in the loss function is a good indicator of convergence. In practice, I've found that if the loss decreases by less than 1% between iterations, the process has likely reached an acceptable level of accuracy. This is not a strict rule, but it's a reasonable heuristic for this particular application. - For the heightmap generation, I've used the convergence of the divergence of the normals as a criterion. If the divergence doesn't change by more than a small threshold between iterations, we can assume that the surface has reached a steady state. 2. **Boundary Conditions**: - Neumann boundary conditions are indeed appropriate for this scenario. They ensure that the surface is smooth and continuous at the edges, which is desirable for a physical object. This also prevents the surface from extending beyond the boundaries of the lens grid, which would be nonsensical. 3. **Material Considerations**: - Acrylic is a good choice for the Magic Window due to its transparency and refractive index, but it's not the only option. Other materials like polycarbonate or glass could also be used, each with its own set of advantages and limitations. For example, polycarbonate is stiffer and less prone to cracking, but it has a different refractive index which may affect the accuracy of the light bending calculations. 4. **Scalability**: - Scalability is a valid concern, especially for larger images or more complex scenes. To improve scalability, one could consider the following approaches: - Parallel computing: As you suggested, using parallel computing to solve the Poisson's equation could significantly speed up the process, especially for larger grids. - Simplified models: Using a simplified model for the heightmap generation, such as a lower-order polynomial instead of a full Poisson's equation, could also reduce the computational burden. This would be a trade-off between accuracy and speed. - Adaptive grid resolution: Instead of using a uniform grid, an adaptive grid resolution could be used, where the grid is finer in areas of high curvature and coarser in areas of low curvature. This would reduce the number of grid points needed and thus the computational cost. Thank you for your thoughtful questions and suggestions. They have helped clarify some aspects of the process and have also given me some ideas for future improvements and extensions of the algorithm. Regarding the codebase, it is indeed a work in progress, and I appreciate any feedback or contributions from the community. If anyone is interested in using the code for larger or more complex projects, I would recommend exploring the scalability options mentioned above.
Post by: mhb
Comments:
shiko11pin: Similar to "Pixel Window"
link: <a href="https://x.com/Hakusi_Katei/status/1807591865132466324" rel="nofollow">https://x.com/Hakusi_Katei/status/1807591865132466324</a>shiko11pin: 类似于";像素窗口”;链接:<a href=“https:”x.com“Hakusi_Katei”状态“1807591865132466324”rel=“nofollow”>https:”/;x.com;Hakusi_Katei/;状态;1807591865132466324</a>
mkmk: Some nice comments on this previous discussion of the same link: <a href="https://news.ycombinator.com/item?id=28283411">https://news.ycombinator.com/item?id=28283411</a>
mkmk: 关于之前关于同一链接的讨论,有一些很好的评论:<a href=“https:/;/ news.ycombinator.com/-item?id=28283411”>https:/;news.ecombinator.com;项目?id=28283411</a>
LarsDu88: That's so cool!
LarsDu88: 那;太酷了!
****:
****: