#### Archived

This topic is now archived and is closed to further replies.

# Interpolation for raytracer

This topic is 5390 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am looking for a good interpolation function to interpolate between two control points for my movie making raytracer. I was using Catmullrom from the DX libraries, but if control points are too far apart the curveature goes a little wonky. Anyone know what things like Bryce or 3DS Max use? Thanks

##### Share on other sites
Fast and easy is 3- or 4-vertex bezier curves. Implementable in any # of dimensions or values... and somewhat fun to learn.

Let A, B, C, D be four values you want to interpolate between, and let u be a value from 0 to 1 inclusive, such that the function below produces the point A when u = 0, and D when u = 1. Let V = (1 - u).

f(u,A,B,C,D) = Au3 + 3Bu2v + 3Duv2 + Cv3

That function is derived by expanding (u+v)3. The "3" is the number of vertices minus one. For just 3 values...

f(u,A,B,C) = Au2 + 2Buv + Av2

... which is given by (u+v)2.

As you may guess, (u+v)1 gives Au + Bv, which is a straight line, and (u+v)1 gives A(1), which is a point. Higher numbers give more "control points", as those values are called.

[edited by - Wyrframe on March 7, 2004 11:16:05 PM]

##### Share on other sites
The problem with bezier curves are they won't pass through the control points in between.

It may be a bug, but if I move in a straight line using catmullrom, it will bob, something like

-----x-->  <------               -----------x---->

that's horrible ascii art (both x's are off a straing line, it's hard to draw with ascii. I am using the DX catmullrom, there might be a bug in my system. I assume that if you travel down a straight line, it would not bob up and down.

Do all modelers use Bezier curves, never passing through all control points?

[edited by - ataru on March 8, 2004 11:56:12 AM]

[edited by - ataru on March 8, 2004 11:58:12 AM]

[edited by - ataru on March 8, 2004 11:58:39 AM]

##### Share on other sites
if 100% straight, it shouldn''t. but catmul has a tendency to bump here and there, when it''s almost straight, but not quite. Also, it''s no C2 continuous (There aer breaks in the second derivative), which is probably why.

##### Share on other sites
And breaks in second derivative( acceleration ) are visible to naked eye, as well as in first derivative(speed).With one difference,it''s bit harder to explain what''s wrong with movement,even to yourself.

[Edited by - Dmytry on March 27, 2005 1:24:20 PM]

##### Share on other sites
If you google for it, you could probably find info on curves which meet their control points.

##### Share on other sites
I will most likley use a bezier curve. It''s for a hack add on job to a system at work, and I''d rather produce better results.

I guess I''m just dissapointed in catmullrom. The reason I stayed away from bezier curves was the fact that it does not pass through control points, but really it''s not a necessity for me.

Thanks for all the help

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633662
• Total Posts
3013231
×