2 ms·
The fact that you can pick a node which is rendered as a fifth or a sixth level of a recursive tree, move it around, and the rest of the tree would react, looks
by nine_k 3y ago
The fact that you can pick a node which is rendered as a fifth or a sixth level of a recursive tree, move it around, and the rest of the tree would react, looks highly magical to me. It works without a function that explicitly infers the initial parameters of the tree from an arbitrary leaf node position.
I wonder how is it achieved, and how well does it work when positions of points are not connected by reasonably smooth functions.
- Chabsff 3y agoIf I had to guess: 1. Get partial derivatives of each parameter's influence on the moved object by sampling the function twice. 2. Perform a bog standard gradient descent. 3. go back to 1 until convergence is achieved. Or you could be lazy and just throw an off-the-shelf optimizer at it.
- HammadB 3y agohttps://github.com/bijection/g9/blob/master/src/minimize.js https://github.com/bijection/g9/blob/master/src/minimize.js
- deleted 3y ago[deleted]
- throwaway4good 3y agoRequires the relationship from the screen coordinates to the variables in the program to be differentiable. It is a very nice idea though.
- jaen 3y agoIt requires the final function to have a numerically reasonable finite difference gradient, which is somewhat different from what is commonly referred to as "differentiable" - eg. the insides of that function could still use non-differentiable/non-analytic functions. It seems to be based on numeric.js, which is based on the classic Fortran UNCMIN [1] optimizer. [1]: https://perception.lab.uiowa.edu/UNCMIN https://perception.lab.uiowa.edu/UNCMIN
- Chabsff 3y agoThey do quite a bit more sampling in order to dynamically determine a good delta value. But apart from that, I dare say that I got it broadly right. It feels to me like there's also quite a bit of temporal coherence that could be leveraged in order to accelerate the process.
- skyde 3y agoI am guessing it's similar to "Inverse kinematics". There are many methods of modelling and solving inverse kinematics problems. The most flexible of these methods typically rely on iterative optimization to seek out an approximate solution, due to the difficulty of inverting the forward kinematics equation and the possibility of an empty solution space. The core idea behind several of these methods is to model the forward kinematics equation using a Taylor series expansion, which can be simpler to invert and solve than the original system.