Don’t look…that would be cheating: http://www.java-gaming.org/topics/quaternions-comment-from-my-cell/36422/view.html
EDIT: Let’s all pretend like the class StrictMath doesn’t exist.
Don’t look…that would be cheating: http://www.java-gaming.org/topics/quaternions-comment-from-my-cell/36422/view.html
EDIT: Let’s all pretend like the class StrictMath doesn’t exist.
I read your slerp derivation stuff, but I can’t say I understand it very well. Quaternions are not my strongest side.
… which solves pretty much nothing since we still need sin(tk) and cos(tk). How would you derive those without going through angles?
I haven’t bumped that thread since all the new stuff is “in progress” It’d be nice if you could tell me what you couldn’t follow in the part starting from the parameterized equation. The equations are simple but nasty to look at…text just doesn’t work…this is part of the reason I’ve not completed the lerp vs. slerp analysis stuff.
My “get rid of trig” is ambiguous…I’m intending the say the trig we artificially introduced.
“we still need sin(tk) and cos(tk)”, both are positive…so one and a sqrt
“solves pretty much nothing” is a matter of perspective. Changing acos -> atan2 or atan is a big win. You need the extra parameter anyway. There are a number of things that could done with this for further reduction. (I don’t know what HotSpot is currently doing with atan and atan2…x87 or software scalar SSE.)
Changing 3 forward trig functions into 1 and 2 sqrts is a huge win.
Everything is on limited ranges so there are lots of other changes are possible…including sizable speed-ups that don’t really effect the error-bound. That’s the ultimate question…what error-bound is acceptable.
All of this is an interesting diversion / mental exercise. Certainly it’s reasonable for a library to want to provide an efficient implementation. But I’ve never talked about optimizing slerp…what I did say is that you don’t need to use it and the JOML and LibGDX implementations give evidence of this.
I give up.
I’ve tried really hard to get to the grips of what is going on here.
And the closest I got was the “Dunning-Kruger effect.” Applied to our situation this implies two things:
But the part that I’ve not yet figured out throughout the whole conversation is:
What in the name of god is it that you, @Roquen, actually want…
Very explicitly, I want to know the following things:
There might just be the chance that you, @Roquen, always wanted to show off what a math buff you are (no pun intended!) and like to teach us about that math stuff. If you want to teach it to us, then thank you, @Roquen, for that! But I would request that you take one or two steps back, NOT writing on your cell phone (you shouldn’t have done it in the first place), and instead maybe prepare a proper paper/article on the topic on a proper keyboard.
That is because everything else just leads to more and more confusion on the topic at hand and (at least for me) on the motives that drive you to write about it.
I’ve always seen him as the guy that walks up to a discussion, says “Lol, there’s a much better solution to that problem” and then walks off with a smug smile, leaving everyone wondering if they’re all stupid or if he’s a troll, so I stopped worrying about it since he’s not of any help anyway.
Cell or not I always make terse comments. My reasoning is simple. The people that actually read what I’ve written fall into:
If anyone from 2 or 3 respond then I’m happy to give further information. If there are no responses then it’s a good thing I didn’t spent time writing more than I did. (2) people are happy as is. (3) people aren’t interested enough to write a question.
“Dunning-Kruger effect.” It’s always hard to not over or under explain thing…esp since members have a wide range of math background. See category 2 & 3 above. (Unless you’re saying I’m in idiot in a nice way) I’m not attempting to get anyone to do any hard math. I started a slerp derivation before it came up in this thread and I’m going to do the slerp vs. lerp analysis.
“motivation”: challenge people, math skills, how they think about programming or attack problem solving.
“might just be the chance that…always wanted to show off”: illogically. My tone would be different and I’d demonstrate my knowledge as rapidly as possible rather than attempt to get others to get to the solution themselves. How could I show off if they were to beat me to the punch?
“NOT writing on your cell phone”: vacation is hard, let’s do some math!
“proper paper/article”: planning on doing a few basics as noted above…but here’s the deal. Very few will bother to read it. Those that do and don’t follow won’t ask any questions. So really it’ll be a waste of time. I’ll bother because just maybe someone will prove me wrong.
Now let me make some observations:
A) How many people have attempted to guess what I’m saying (in a post)? Zero.
B) How many people have asked a question in an attempt to follow my reasoning? Zero.
KaiHH != Zero.
[quote]Unless you’re saying I’m in idiot in a nice way
[/quote]
I am not saying that.
[quote]I’m not attempting to get anyone to do any hard math. I started a slerp derivation before it came up in this thread and I’m going to do the slerp vs. lerp analysis.
[/quote]
That’s good. Okay, now I think I get the picture. You try to (let’s say) intersperse information and ways of solving a specific problem, and your thoughts can then be taken by people and developed further and asked about if they like, or not. That’s of course okay.
[quote]My tone would be different and I’d demonstrate my knowledge as rapidly as possible rather than attempt to get others to get to the solution themselves. How could I show off if they were to beat me to the punch?
[/quote]
Could be. Not that I impute that to you, but people always find ways to still somehow “show off” in a convoluted way that allows preserving their ego not being “beaten up.” And your tone at times is already pretty non-diplomatic, provocative and “smart-alec” (had to look that word up, don’t know if it’s right )
[quote]A) How many people have attempted to guess what I’m saying (in a post)? Zero.
[/quote]
That observation I cannot share. @theagentd and I went to some lengths in trying to understand what you were saying and then gave up.
But if someone is being perceived like @theagentd layed out, then something is clearly wrong somehow. I think the reason might be that the JGO platform is about getting specific and readily applicable help for an expressed problem. And then maybe the intersperse of information about how something should “not” be done in a specific way is just somewhat “orthogonal” to what people expect. Which is: a direct solution.
I think that is the reason why your posts are sometimes perceived as you wanting to teach someone about something that does not directly lead to a solution of the problem, or that - as I pointed out - does not state the actual goal/desired outcome of what you’re trying to say.
I think we can generalize the statement made by KaiHH, and observe that pointing out problems whilst not intelligibly explaining a solution, does not work in the majority of social contexts. Only in rigid hierarchies such communication can potentially be considered helpful or motivating, but even then it is frowned upon, and usually used as a last resort.
To paraphrase myself from an earlier reply: being correct is meaningless when you cannot convince people that you are correct. You have to descent all the way down to the level of whoever you’re trying to convince.
I will probably split all this off into it’s own thread, once things settle down, so we can focus on JOML again, soon.
I actually appreciate Roquen’s attempt to get people thinking. I’ve had him highlighted since Riven implemented that feature, he always has something interesting to say. But yes, his short/vague replies can be frustrating many times.
Anyway, I’m a practical guy and don’t have time for derivations. What Roquen’s replies made me think was: if there’s anything interesting to be said about slerp, someone has said it already. So I used google: Understanding Slerp, Then Not Using It and Slerping Clock Cycles were the interesting hits. Everything you need to know about slerp is in there.
I ported the id code to Java. First of all JOML has a bug: it doesn’t check the dot sign and doesn’t flip the second sine based on that. This results in interpolation in the wrong direction (not the shortest one). Benchmark results (ns/slerp):
JOML: 324ns
id: 363ns (reference)
id: 149ns (optimized)
id: 47ns (approximated)
Then would you care to pleeeaaase make a Pull Request or post your already available and apparently benchmarked Java code here for JOML to benefit from that?
Sure: http://pastebin.java-gaming.org/8d63d9f28331f
You should be able to use slerpOptimized in JOML as is, just rename the variables to match the original and remove the C-style declarations at the top (hate that).
The approximated version should have decent quality, but I’m not sure if/how you want it in JOML.
Awesome. Thank you! And also thanks for spotting the bug with the current implementation.
I would include the “optimized” version then, since that does not seem to make any strong assumptions on the input parameters.
To decide on whether the approximated version should also be included I would probably want to ask the users of JOML, whether anyone here feels the need for that?
Also, maybe we can have guards/branches that first test whether the approximation is applicable - the angle being in [0…PI/2] (provided of course that the branching itself would not introduce a high overhead).
The approximation is always applicable, by definition: “Both parameters to the arc tangent function are always positive”. That is, omega is always an angle in the first quadrant.
Oh yeah? Must be losing my memory…age and all.
Riven: The answer isn’t interesting…it’s trivia. It’s someone finding or fumbling their way toward the answer that’s interesting.
Ok. I’ve said slerp isn’t interesting for runtime (add in the implied when it’s statistical significant). I’ve attempted to point in the right direction by saying the two implementations help demonstrate that. I didn’t imply their were buggy (actually I haven’t even looked). So what’s left is a couple of lines of code. Specifically they break the domain into two parts and slerp for the larger angle range and (n)lerp for the smaller.
They use dot results of .9 and .95 for the partition. Big deal right? For small angles the arc and coord are very close.
acos(.9) = .31756
acos(.95) = .451027
Yeah small angles. Oh wait…that’s radians, let’s do degrees: 18.1949, 25.8419. Humm…these are kinda smallish angles. Oh and there’s the half/double angle relationship, so in 3D they’re: 36.3897 and 51.6839. Ok…not so small. In percentages that’s 20.2165 and 28.7133 percent of the whole domain.
So if typical animation data is feeding these routines random input then we’d lerp at about those rates. But in all raw animation data I’ve ever run across, the distribute is more exponential than uniform and peak “energy” is closer to zero then to these cutoff points. And when the angle’s aren’t small enough in the raw data, subdivide. If you add to this that you want to do constant velocity between points to keep the code simple and fast…that’s more subdivisions you’re gonna need to mimic non-constant AV.
Okay, I am actually interested in what you want to say - please note that.
So please explain in more detail what you mean/want to change and while doing this, please use simpler language and no words like “energy”, “cutoff points”, “raw data”, “subdivide”.
Pesky kids, posting while I’m trying to fumbling one out. As an aside Jonathan Blow now advises to never do anything other than nlerp…Fabian Giesen (aka rygorous) and Casey Muratori as well. That’s the animation systems of a few thousand video games.
You know what about be interesting? theagentd collecting and give histogram from wsw.
@KaiHH: Some of the routines I mentioned much earlier are related to all of this. I’ll toss some java versions together when I have some time.
He’s saying (correct me if I’m wrong) that in practice most calls to slerp tend to be small angles (and if they aren’t, you would want to subdivide those angles in your animations), and thus reduce to nlerp, so slerp is not necessary.
That id version (looking at paper) is missing some of the optimizations talked about earlier in this thread.
@BurntPizza: yeap…at conversion or set-up time.