JF https://www.javantea.com/page/make/273

Tonight we got some development. I came up with a new equation in my physics class and this picture is the first fruit of it. Below is the derivation.

Derivation for auto-Smooth using (position, speed) list.

Abstract

This derivation takes a list of values for position and speed and assuming constant acceleration between two points finds the direction of the velocity and the acceleration of the at all times for the particle. Using only one sqrt and a low number of vector dot products, it is plenty fast enough for real-time with a medium number of particles which it is designed for.

Introduction

Usually, full knowledge of a system is impossible. However, it is convenient to know position and velocity of a particle. Especially in movies, constant acceleration between a set of points gives very nice smoothness. Knowing that a person can only walk at a certain speed and that the person was at a certain position and changed motion at a certain position is enough for this algorhithm to find the exact curved path taken. Since curved paths are more natural, this gives a positive appearance to the 3d animation. Compared to bezier curves, this system is preferred due to it's strict boundary by Newton's First Law of Motion. In simulations this method will hold to the truth and can be used directly with reliable units (seconds, meters, m/s, m/s/s, and Newtons).

Derivation

// Constant Acceleration Equations
p(t0+dt) = p0 + v0*dt + 0.5*a0*dt*dt
v(t0+dt) = v0 + a0*dt
p1 = p0 + v0*dt + 0.5*a0*dt*dt
v1 = v0 + a0*dt
a0 = (v1 - v0)/dt
p1-p0 = v0*dt + 0.5*(v1 - v0)/dt1)*dt*dt
      = v0*dt - 0.5*v0*dt + 0.5*v1*dt
      = 0.5*v0*dt + 0.5*v1*dt
      = 0.5*dt*(v0 + v1)
v1 = 2*(p1-p0)/dt - v0
|v1|^2 = 4*(|dp|/dt)^2 - 4*(p1-p0)*v0/dt + |v0|^2
(|v1|^2 - |v0|^2)*dt*dt + 4*(p1-p0)*v0*dt - 4*|dp|^2 = 0

// Simply the quadratic formula for a quadradic equation to find dt
A = |v1|^2 - |v0|^2
B = 4*(p1-p0)*v0
C = 4*|p1-p0|^2

if A = 0:
	if B != 0, dt = -C/B
	else return false.
end if

if (B*B - 4*A*C) < 0, return false.

n = sqrt(B*B - 4*A*C)

dt1 = (-B + n)/(2*A)
dt2 = (-B - n)/(2*A)

if dt1 > 0 and dt2 > 0, dt = min(dt1, dt2)
else:
	if dt1 > 0, dt = dt1
	else if dt2 > 0, dt = dt2
	else return false.
end if

v1 = 2*(p1-p0)/dt1 - v0
a0 = (v1 - v0)/dt1

Data

Given: t0(0), v0(0), |v0(1)|, |v0(2)|, p0(0), p0(1), p0(2)
Calculated: t0(1), t0(2), v0(1), v0(2) a0(0), a0(1), a0(2)

AP time="0" p0="-4.34386 6.44146 42.3769" v0="1 0 0" a0="0.167412 -0.409133 0.522076"
AP time="6.07517" p0="4.82071 -1.10861 52.0112" v0="2.01706 -2.48555 3.1717" a0="7.41245 3.03146 -0.833135"
AP time="7.71501" p0="18.0946 -1.10861 56.0921" v0="14.1722 2.48555 1.8055" a0="0 0 0"

Results

The paths made were curves for the most part. As you can see in the code, there are a few cases where a solution will not result. Those times are: when v0==0 and v1==0, dt < 0, or B*B -4*A*C < 0. The physical situations where this happens are simple. One part of the equation prone to problems is setting v0(0). It usually causes problems like making a large acceleration to get to the second particle. The best solution I have found is to set v0(0) = 0,0,0. This says that the person or camera isn't moving at time zero and thus it accelerates from zero resulting in a straight line. If your person or camera is moving at time zero, it is trivial to set it to a multiple of p1-p0.

Conclusion

This derivation provides a stable and working system in 3 dimensions for a particle with constant acceleration which only knows position and speed at certain times. This system obeys Newtons laws and looks curvy and smooth to a viewer in a 3d world.

So now you want to know what I plan to use it for, right? Well, all along I've been talking about JF Anime. It was actually my original goal. I started using Half-Life to attempt a machinima solution to 3D Anime. I found that it was impossible. FPS were made for either first-person, projectile combat, or drama at a distance. Getting two characters to interact realistically with the Half-Life engine was right next to impossible. So now AS3D will do that. You see Jav punching, kicking, and duct-taping the EGs and the DAs. Anime director needs interpolation like you can't believe. Doing animation in MS3D only goes so far. You can really only get one person at a time in MS3D. Once you get each one done in MS3D, AS3D does the good stuff. With a smooth pathing system, AS3D Anime Director is about 40% done. I need an easy looping animation system and it'll be ready for beta testing. This sudden work on Anime Director is in response to my recent leaning towards new projects: Hack Mars and much more recently BikeIM. I haven't talked much about BikeIM because it's literally only 5 days old. Then I thought: what am I doing, working on another project? Manga Director is ready for use, let's work on JF! But then I thought, to keep myself off the topic of BikeIM, I'll develop Anime Director, a much more pressing project. The idea of BikeIM was that it would take only 3 weeks no matter how ugly it ended up. I just wanted a full-motion animation/game to show companies that I'll be applying to as a demo. But then I thought: 3d anime is as cool if not more.

So I'm slacking on that even. After finishing the path system, I went on to the drag and drop system. It's going to take a while because while it works when the pitch is zero, it doesn't work when pitch is not zero. Funny, huh? So I went on the web and checked out D7 Peacemaker. You might remember a rant about a motion comic book. I didn't give it very good marks because I seriously need moving lips in movies. Looking back, I didn't even link to D7 or even say it's name. Probably because I didn't want to embarass them or myself by criticizing it too much. Well, I looked at their character pictures for D7 Prodigal Child and I was shocked beyond amazement. The quality of the wallpapers are higher than anything that I currently have. I downloaded it. Then I checked on D7. I found that they're on sale for $20. I picked it up. Why? I'm poor, very close to broke. But I can still see value in things that cost money. The D7 wallpapers are the highest quality things I've seen for over a year, so that gives it good marks. Not enough. The Prodigal Child however is described as: "Presented as a full length 3d animated feature Prodigal Child takes place in the aftermath of the DVD series. This feature is the first in the theatrical trilogy which is currently in pre-production." It's in direct competiton with Javantea's Fate Anime. It is in pre-production, so if I step up my development cycle, the release times could be within 6 months of each other. I decided to buy D7 because it will give me insight into what I will need to do in 1 year. If you're as poor or poorer than me, I'd suggest that you download the wallpapers at least.

If I'm going to compete with D7, I'll need wallpapers.
Here's one [lo res].
Another [lo res].
I'll give these a one-click page with thumbnails soon.

Permalink

Comments: 0

Leave a reply »

 
  • Leave a Reply
    Your gravatar
    Your Name