Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Raizor on January 30, 2012
-
I'm currently working on something that could do with a few touches to finish it off.
I have a logo made of cubes (3d pixels). The pixels are placed randomly in 3d space and fly to their final positions to form the logo. I'm currently using a lerp and staggering the start times of the cubes, which looks ok but is really missing something.
I was wondering if anyone had any suggestions to make the movement more interesting. I'm doing this in a vertex shader, so ideally whatever I do shouldn't be overly processing hungry as it's called for a lot of vertices.
I'm thinking of interpolating between the source position and destination via an intermediate position (with some kind of weighting for the intermediate position based on the current position between source and destination). I'm sure I had some code from years ago to do something like this on the PS2, but can't for the life of me find it. Any ideas or suggestions would be great, thanks.
-
Do you just want a simple curve or something fancier?
If you want a more natural looking motion you could add a bit of lowpass filtered noise to create a couple of key-frames in between.
-
A curve would probably do it. As long as I could have a slightly different curve for each object being moved. Once I've got one curve, the others should come fairly easily I guess.
-
I love springing to position, it's simple, short and probably cheesy but it works suprisingly well every time. By varying the strength in creative ways you can give a nice organic feel to it. I'm not familiar with lerp or staggering but it sounds a lot more awesome then simple springs...
Looking forward to whatever kind of awesome you're working on. :kewl:
-
Kirl, what do you mean by springing? Moving straight from point A to point B, or in a spiral motion?
-
A curve would probably do it. As long as I could have a slightly different curve for each object being moved. Once I've got one curve, the others should come fairly easily I guess.
If you already have a source- and destination-point (and don't want more points) you just have to figure out useful tangents for the two.
-
Springing like it's attached to an invisible spring, so that it overshoots it's target position a few times before settling into it. It generally moves in a straight line unless you give each cube some sort of start velocity over another direction. Collissions will occur when springing from random start positions though. You can place them into creative offscreen starting positions + velocity to get some interesting motion without collission.
But again, springs sound kind of n00b compared to l33t terms like lerp and stagger, haha... ;D
(I'll have to read up on those)
-
@Hellfire, thanks.
@Kirl, ah, I see. Yeah, that does normally look good. Lerp is nothing complicated, just a way to get a position between two numbers. You feed the lerp method number1, number2 and a value between 0 and 1 to represent time. A lerp of 0.5 would return the middle of number1 and number2.
-
I see, thanks for the explanation. That's the kind of lingo I like to casually drop in trivial conversation! ;D
-
its a very interresting subject for me.
Perhaps there also can be used some splines to do different ways from A to B
Is there an example we can see at its status?