-> the red are planes at current position (simpified)
and i want to find out how far i have to move them on the z axis for them to create a surface where the planes are the tangent line on that point of the curve
if anybody has an idea I would greatly appriciate the help
See this concept/algorithm.
(I’m not a mathematician or such… take everything i say/post as an option from a hobbyist)
What you have are derivative values, to rebuild you need to do the integral of those values.
I interpolated point locations and vectors (with catmull interpolation).
With mass addition > partial result, every point is moved in Y for the sum of all previous point/vector.
Number of samples is highly relevant.
integral.gh (19.5 KB)
Point spacing is even, maybe with an uneven spacing it give wrong results (or wronger).
I don’t know if this is correct, this is very likely do be doable by pure math very better. (sorry for my english)
You didn’t attach you data, so i created this to try the concept.
You have many vertical planes (near flat/horizontal planes!)… an analogue 3d version of this algorithm won’t work.
it does exactly what i need for the simple version with just some vectors in 2d
do you have a suggestion on how to go about it in 3d when the planes are scattered about and not in some kind of grid?
I am new to GH and not sure if there is a simple adaption from what you showed to the 3d surface
I was thinking about it … somehow.
A first “translation” that came in my mind would require a 4-dimensional space environment … (as said, i’m not a math pro… “simple” situation > stupid solutions).
The first step would be to interpolate through your samples, “subsampling”, making a more dense (increased number of samples) but equally spaced grid.
I would do 2 surface with “patch surface”, one for XZ curvatures/tangentvectorangle and another for YZ… smoothing the Z values.
But I’m not sure if “splitting” the curvatures into 2 “derivative graphs” would broke the total smoothness.
(hence why an ideal solution “would be” a 4-D derivative graph")
I don’t know.
Maybe i’m completely off road, googling the right keywords might lead us to proper solution… but i don’t know what to search for.
I’m just writing what I have in mind… madness atm.
What you have are samples of a possible “normal map”
1st result googling “reconstruct from normal map”:
Beware:
Your calculations are done (probably) using distance as your “lens” is flat, like a fresnel lens.
After you have your first shape, you will likely need to re-iterate through it doing again your math but with new distances (some parts of the lens are nearer the object and further from projection panel and vice-versa), and so the ray angles will change a bit (becoming more precise).
Or, you know, find a direct math calculation.
This solution can somehow “interpolate” through uneven located 3d-vectors.
It’s heavy and very likely imprecise and wrong, probably wasted time.
You need a math expert to do what you need.
Anyway, in my solution i make 3 patch surface through 3 different sets of points.
Each set is made by moving in Z the sample point by the component of its vector (X, Y, Z … hence 3 sets)
Then intersecting the surfaces with a grid of rays and reconstructing the vectors to have the even field.
(inside is a c# to extend surfaces and a c# to convert vector to normal color)
How to do the next step, from vector to 3d shape, is still a mystery to me.
(but, as said, the first step is already “fake”… so…)
I re-quote myself:
“Your calculations are done (probably) using distance as your “lens” is flat, like a fresnel lens.
After you have your first shape, you will likely need to re-iterate through it doing again your math but with new distances (some parts of the lens are nearer the object and further from projection panel and vice-versa), and so the ray angles will change a bit (becoming more precise)…”
I like challenges, indeed.
But I’m missing knowledge (as always), and the empiric methods I use not always get to a result.
(another thing, the Olympic logo in your sources have creases dividing the colors; those are like different lens shapes joined together… what are we doing here is just 1 lens. Your refraction lens will not have “creases”… or, it could have them, but with a very high sample resolution… which is madness!)
ah now I understand what you ment. sorry I didn’t quite get that
with
I didn’t mean you but me and not giving up on my goal ^^
yeah I know
One of my friends is a math student. I will try and see if he can make time for me. If he does and I get to a “solution” or rather a approximation that works close enough, I will post it here for anyone who is interested
Interpolation between points was unreliable (patch would take unpredictable shapes)
Needing another method to “interpolate” between a set of 2D-random-placed values, I switched to using mesh-spray functions.
I try to describe now shortly the process:
I created a set of points (flat, Z=0) , each with its normal vector. In the script I used a semi-sphere as a source.
Done delaunay mesh from those points + some far point to get a large, extended mesh
Converted normal vectors to normal colors and colored the mesh with spray points
evaluated the mesh with a high-resolution grid of samples to get an even distributed matrix of color samples
converted color to vector back again
From now on the method is likely to be inaccurate/wrong/incomplete
(or maybe i’m just lacking enough resolution, the 2D version was fine ONLY with very high resolution)
we have a matrix of vector samples to use for moving the matrix of point
for each row, starting from first point (still), calculated final Z for each element as the sum of the “steep” (tangency) of all previous element
same for each column
for each point in the matrix, done the average (of Zs) from row and column results
Hi
I wouldn’t call the result meh
To be honest this is better than anything I even got too (by far )
Maybe not the 100% correct way mathematically, but I think that you have had to study math to be able to complete solve this issue
I will try this solution tomorrow (from front to back -> taking an image sampling it to define where light rays need to go and calculating vektors | then your script) and then render a caustic image from the generated geometry and see how it looks. Will post image here
hi
sorry it took me for ever to get back to you.
well better late than never
I tried it with one of my results of planes and plane normals. As you expected the result are by far not as good as what you got with your sphere example. but there you had one continous motion of vektors and not a wild something like me now
here is what it looks like when i try inputting my planes:
i moved each plane on the zaxis to match up with its neighbor on a row by row basis. and then reoriented the the plane to still have the correct refraction of light.
also still not the results i was going for, but ^^ Don’t really want to give up