What math stuff did you find surprisingly useful in the demoscene?
category: general [glöplog]
^as the title says
Useful for what?
people are free to specify for what
eg: i found X to be useful to do Y
eg: i found X to be useful to do Y
Realizing that ln(ab) = ln a + ln b and exp(a+b) = exp(a)*exp(b) finally had a concrete application beside just passing an exam :D
sin(t) has been surprisingly useful to make sinus scrollers
vertex normals can be used for (fake) env mapping. Not sure if it really can be called "math" stuff tho :)
This question would be closed on Stack Overflow for being too vague ;) So, a vague question deserves a vague answer....
Mathematics can be coarsely divided into numerical and theoretical stuff, and probably most of the numerical stuff can be applied in demos. Of course, the division is not that black and white; you still need to prove that your computations give approximately correct results and that an alternative way of doing a computation is also giving correct results. But in computational work, the theorems are more of a tool to simplify your computations; people don't bother proving them just because they are "beautiful".
If the question is actually "what should I learn", off the top of my head:
- matrix / vector algebra / basic geometry; for 3D graphics
- differential equations & solving them numerically; especially for (audio) signal processing, rigid body dynamics
- partial differential equations & solving them numerically; especially for continuum and fluid mechanics (we love fluid simulations)
- complex numbers and quaternions; for fractals and rotations
- optimization; for example: there's an optimization algorithm in practically every cruncher
- statistics, probability and information theory; for crunching and Monte Carlo stuff in e.g. rendering
Looking at the list, maybe it's better to ask what math has no demoscene use? :) I'd say you might be able to learn all that without knowing what a field or an abelian group is... You can pretty much use all that stuff without having that deep understanding of the underlying theories. But there might be a nagging feeling that "you don't get it after all" :) So the computational stuff can be a gateway drug to the more theoretical stuff.
Anyways, if you are at uni, seek the applied mathematicians - especially the guys working at the "numerical" or "computational" stuff - and take their courses. The Computer Science or Engineering faculty often contain a few signal processing, control engineering or fluid mechanics guys, who are likely to teach some useful applied math.
Mathematics can be coarsely divided into numerical and theoretical stuff, and probably most of the numerical stuff can be applied in demos. Of course, the division is not that black and white; you still need to prove that your computations give approximately correct results and that an alternative way of doing a computation is also giving correct results. But in computational work, the theorems are more of a tool to simplify your computations; people don't bother proving them just because they are "beautiful".
If the question is actually "what should I learn", off the top of my head:
- matrix / vector algebra / basic geometry; for 3D graphics
- differential equations & solving them numerically; especially for (audio) signal processing, rigid body dynamics
- partial differential equations & solving them numerically; especially for continuum and fluid mechanics (we love fluid simulations)
- complex numbers and quaternions; for fractals and rotations
- optimization; for example: there's an optimization algorithm in practically every cruncher
- statistics, probability and information theory; for crunching and Monte Carlo stuff in e.g. rendering
Looking at the list, maybe it's better to ask what math has no demoscene use? :) I'd say you might be able to learn all that without knowing what a field or an abelian group is... You can pretty much use all that stuff without having that deep understanding of the underlying theories. But there might be a nagging feeling that "you don't get it after all" :) So the computational stuff can be a gateway drug to the more theoretical stuff.
Anyways, if you are at uni, seek the applied mathematicians - especially the guys working at the "numerical" or "computational" stuff - and take their courses. The Computer Science or Engineering faculty often contain a few signal processing, control engineering or fluid mechanics guys, who are likely to teach some useful applied math.
Programming is often about getting to B from A, and math gives a lot of tools for finding the route.
Take project euler as an example. Pick a puzzle. Spend time making some implementation that solves it in finite time. Optimize the implementation a few times. Wait for your implementation to finish in a couple of hours. Post result. Check the forums to find a bunch of math snobs stating that of course this was an application of some forgotten theorem by some minor mathematician a thousand years ago and everybody should find the solution in milliseconds.
There's always more than one path from A to B. It's great when you're the one who finds the fast path. It's friggin annoying when someone else does. ;)
Take project euler as an example. Pick a puzzle. Spend time making some implementation that solves it in finite time. Optimize the implementation a few times. Wait for your implementation to finish in a couple of hours. Post result. Check the forums to find a bunch of math snobs stating that of course this was an application of some forgotten theorem by some minor mathematician a thousand years ago and everybody should find the solution in milliseconds.
There's always more than one path from A to B. It's great when you're the one who finds the fast path. It's friggin annoying when someone else does. ;)
for run-of-the-mill programming you need very little maths... primary school level calculus at most, luckily :D
Linear algebra.
Quote:
Linear algebra.
That's not really surprising though is it?
Quote:
Quote:Linear algebra.
That's not really surprising though is it?
If you're not really familiar with it yet or don't know what it's useful for the, degree to which it's crucial I'd say can be very surprising... especially since in my experience anyway schools by default don't really emphasize that basically all 3D math relies on it. Probably would've made me try to pay more attention to it...
Yeah in that sense that's 100% accurate.
Well, yeah, linear algebra is pretty much the foundation of all computing stuff. Almost all numerical stuff e.g. optimization, solving (partial) differential equations boils and 3D geometry boils down to bunch of matrix and vector operations. If they give a headache, then that's something to overcome first...
But that's why most uni math starts with vectors and matrices :) To keep demosceners motivated, they could use more examples from 3D graphics, but then again it would be catering to a minority. Majority would still be like "wtf? USELESS" and I would find it hard to counter that with the demoscene as an example :D "but but.... it's cool stuff"
But that's why most uni math starts with vectors and matrices :) To keep demosceners motivated, they could use more examples from 3D graphics, but then again it would be catering to a minority. Majority would still be like "wtf? USELESS" and I would find it hard to counter that with the demoscene as an example :D "but but.... it's cool stuff"
My math book advertised 3d rotation and translation as the anonymous “change of coordinate system”. If it had said “quake graphics math” it might have turned a few more heads
My first thought:
The math for supershapes / super formula (2D and 3D).
When i heared and read about it the first time; and saw the first 2D and later the first 3D generated objects/shapes, i was really very surprised and at the same time enthusiastic about this formula and its peculiarity.
The math for supershapes / super formula (2D and 3D).
When i heared and read about it the first time; and saw the first 2D and later the first 3D generated objects/shapes, i was really very surprised and at the same time enthusiastic about this formula and its peculiarity.
On the other hand:
I am very surprised about all the math you need, to generate procedural sound / complete amazing tracks, audio effects, generating textures, image filter effects, procedurally generated 3D meshes / scenes...
Math is so amazing and today i see it again and again in a lot of parts in our nature/life... take a look to the golden aspect ratio... isnt't this all just wonderfull and amazing math?
I am very surprised about all the math you need, to generate procedural sound / complete amazing tracks, audio effects, generating textures, image filter effects, procedurally generated 3D meshes / scenes...
Math is so amazing and today i see it again and again in a lot of parts in our nature/life... take a look to the golden aspect ratio... isnt't this all just wonderfull and amazing math?
The Pareto principle
Quote:
The Pareto principle
But is it "80% of demo is done with 20% of effort" or "80% of demo gets done in 20% of time (right before deadline)" or "80% of demos get done by 20% of sceners"? :)
I've had the opposite experience, of some math being surprisingly useless...
Back when I was getting into demo coding (aged 15ish) I wanted to learn how to make vector graphics. I naturally thought that to make vector graphics I'd need vector math. So I went to the library and borrowed a book about vector math. Some ordinary high school curriculum book. I learned about vectors, dot products, cross products, vector projections and other such stuff. Interesting and ultimately useful, but not sufficient. After reading the book, I still didn't know how to make vector graphics.
It was some time later that I happened upon a book describing rotation transformations and perspective projections. Those were the missing pieces, and I could finally make vector graphics!
Back when I was getting into demo coding (aged 15ish) I wanted to learn how to make vector graphics. I naturally thought that to make vector graphics I'd need vector math. So I went to the library and borrowed a book about vector math. Some ordinary high school curriculum book. I learned about vectors, dot products, cross products, vector projections and other such stuff. Interesting and ultimately useful, but not sufficient. After reading the book, I still didn't know how to make vector graphics.
It was some time later that I happened upon a book describing rotation transformations and perspective projections. Those were the missing pieces, and I could finally make vector graphics!
Addition
Can't make a demo without a + or add somewhere in the code.
Can't make a demo without a + or add somewhere in the code.
Transform from one range to another range.
Code:
fn remap(value: f32, a: f32, b: f32, c: f32, d: f32) -> f32 {
c + (d - c) * (value - a) / (b - a)
}
Back when i started coding, I found the modulus operator to be suprisingly useful.