Idea: non-linear interpolation via CSQC

Discuss CSQC related programming.
Post Reply
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Idea: non-linear interpolation via CSQC

Post by frag.machine »

Not sure if this is the right place to throw the idea, or even if it's something that already exists in some form but anyway...

After watching this presentation, I started to think about how some of these clever ideas could be implemented in idtech2 engines.

Currently even the more austere engines (like FitzQuake) already have linear interpolation baked, but there is very little if any control over how it works. At most, you can toggle it via cvars or skip lerping for a frame. What I was thinking about was giving more control via QuakeC (more precisely, CSQC), so you could at least use non-linear animation (which already looks way better), but not only this: velocity/movement-direction dependent animations, perfect sync between interpolation and animation (no more being locked in 10Hz), truly keyframe-based animations (meaning less work for modellers and less memory wasted when loading models) and a less hacky way to completely skip interpolation when desirable (say, using stock id weapon models).

I was thinking about how this could be implemented in a clean way and I reckon that maybe something like a non-required CSQC hook in the entity (like .float () th_lerp;) would be enough. th_lerp would calculate and return the interpolation factor for the entity (between 0.0 and 1.0).If self.th_lerp = null then just use the engine baked lerp animation, so legacy mods would still work as expected.

Spike ? LordHavoc ? Anyone ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Idea: non-linear interpolation via CSQC

Post by Spike »

csqc's .predraw function is responsible for adjusting the entity on a per-frame basis, thus ensuring it appears in the interpolated position.
the engine does not automatically interpolate entities for you.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Idea: non-linear interpolation via CSQC

Post by frag.machine »

I see. In other words: what I was proposing already can be done handling .lerpfrac, .frame and .frame2 at .predraw(). Thanks for clarifying.

EDIT: Huh, it seems things are a bit more complicated...

Code: Select all

.float frame;
.float frame1time;
.float frame2;
.float frame2time;
.float lerpfrac;
(...)
.float baseframe;
.float baseframe2;
.float baseframe1time;
.float baseframe2time;
.float baselerpfrac;
What are the differences between frame* and baseframe* fields ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Idea: non-linear interpolation via CSQC

Post by Spike »

lerpfrac, frame, frame2 can be used to lerp between frame and frame2, just set frame2 to the old value and allow lerpfrac to tend towards 0 or so.
frame1time+frame2time control the time into the framegroup (4-way blending).
you'll need to interpolate origin and angles yourself too, of course. which can be great fun...

the basebone field can be used to specify a waist bone index. the other baseframe etc fields then control the bones with a lower value, with the regular frame etc fields independantly controlling the higher bones. this naturally requires a skeletal format like iqm. with this extension there's no support for twisting the waist or anything fun like that - the skeletal objects extension is just more feature complete. the only real advantage of this feature is that it is simpler (potentially simple enough that I *could* network it up and provide control from ssqc too).
note that as far as I'm aware, dp doesn't support this. so yeah, use skeletal objects instead.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Idea: non-linear interpolation via CSQC

Post by frag.machine »

I think lerpfrac and frame2 will be enough to experiment some of the ideas in the video. Thanks for the help, Spike.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
jitspoe
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Idea: non-linear interpolation via CSQC

Post by jitspoe »

That was an awesome presentation. Now I want to work on making player animations look better in Paintball2. :)
Post Reply