Inside3D!
     

Software Quake MDL Frame Interpolation
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Programming Tutorials
View previous topic :: View next topic  
Author Message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Fri Jun 25, 2010 11:30 am    Post subject: Software Quake MDL Frame Interpolation Reply with quote

In case anyone missed it. Wink

Software Quake Frame Interpolation

This is a code-dump of an r_alias.c that does frame interpolation, together with a few implementation notes on changes required elsewhere to support it. I was going to do a tutorial, but the changes throughout the code are quite extensive, and most of them are just one or two lines, so it's easier for all of us to just give the full code and let you attack it with your favourite diff tool.

You should be pretty much able to just "drop-n-go" this into a standard ID software Quake codebase.

It doesn't do anything fancy like attempting to fix up muzzleflashes, and doesn't cover movement/orientation interpolation; the old interpolation tutorial can be used for that quite effectively (just move the changes from R_RotateForEntity to CL_RelinkEntities).
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Fri Jun 25, 2010 11:41 am    Post subject: Re: Software Quake MDL Frame Interpolation Reply with quote

mh wrote:
In case anyone missed it. Wink

Software Quake Frame Interpolation

This is a code-dump of an r_alias.c that does frame interpolation, together with a few implementation notes on changes required elsewhere to support it. I was going to do a tutorial, but the changes throughout the code are quite extensive, and most of them are just one or two lines, so it's easier for all of us to just give the full code and let you attack it with your favourite diff tool.

You should be pretty much able to just "drop-n-go" this into a standard ID software Quake codebase.

It doesn't do anything fancy like attempting to fix up muzzleflashes, and doesn't cover movement/orientation interpolation; the old interpolation tutorial can be used for that quite effectively (just move the changes from R_RotateForEntity to CL_RelinkEntities).


Haha Very Happy Very Happy Very Happy OMG!

Awesome!

I might tutorialize this and turn it into a cvar if possible. Now if only I could find the code for movement interpolation (it's buried in some version of JoeQuake or aguirReQuake).

Extra info: JoeQuake Build 1862 has lightstyle interpolation according to the docs even for software renderers. Not that I noticed ... I guess my eye isn't trained as to quite notice it -- I suppose I'd need to find a flickering light or glowing orb or something.

Anyways, thanks!
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Fri Jun 25, 2010 12:04 pm    Post subject: Reply with quote

Oh, I've had lightstyle interpolation for years! Laughing

It's really easy, just a small change in R_AnimateLight.

The old QER interpolation tutorial was saved here: http://www.quakewiki.net/archives/qer/tutorial4.html Very Happy
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Fri Jun 25, 2010 1:01 pm    Post subject: Reply with quote

Works like a charm!

Your documentation in the .zip is perfect, no good reason to do a tutorial of it or anything ... although I'm going to attempt to use this with a cvar.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Fri Jun 25, 2010 1:27 pm    Post subject: Reply with quote

Good to hear!

I should mention that I changed the names of some entity_t members; from pose1 and pose2 to lastpose and currpose. I never was happy with the names that the QER tutorial used; not descriptive enough! Very Happy

It shouldn't be that big a deal as I wouldn't imagine that too many people have done interpolation in software Quake, but you'll need to know it if you're ever planning on integrating the two.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Jun 25, 2010 1:28 pm    Post subject: Reply with quote

[offtopic]tbh, I'm not that keen on lightstyle interpolation. makes flickering lights look ugly, and the lightmap uploads/regeneration every single frame gives a biiig slowdown.[/offtopic]

I thought NQ had fully functional movement/angles interpolation already...
All but for stepping monsters, which have an explicit flag set that stops them from being interpolated so they don't slide and judder, but merely judder. Just ignore that flag if frame interpolation is active.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Fri Jun 25, 2010 1:39 pm    Post subject: Reply with quote

mh wrote:
Good to hear!

I should mention that I changed the names of some entity_t members; from pose1 and pose2 to lastpose and currpose. I never was happy with the names that the QER tutorial used; not descriptive enough! Very Happy


I figured that out before reading your readme.txt. I don't like names that aren't descriptive either.

I might add that animation interpolation without movement interpolation looks even worse than having neither.

Btw ... JoeQuake doesn't seem to have it, I think I was mistaken thinking it had movement interpolation in the software version but rather render.h had an #ifdef GLQUAKE removed in 0.15 so maybe I just assumed.

Spike wrote:
[offtopic]tbh, I'm not that keen on lightstyle interpolation. makes flickering lights look ugly, and the lightmap uploads/regeneration every single frame gives a biiig slowdown.[/offtopic]


Eh well then maybe I won't implement that in software either. I loaded up JoeQuake (Software renderer version) and was trying to see if I could tell the difference.

Quote:
All but for stepping monsters, which have an explicit flag set that stops them from being interpolated so they don't slide and judder, but merely judder. Just ignore that flag if frame interpolation is active.


Hmmmm. Could you explain this more?

See I hate interpolation in NetQuake deathmatch multiplayer and in NQ multiplayer (online) coop the monster movements look ugly as hell even with interpolation and is completely jerky.

What flag is this? The movetype? At least it would solve one of the strange mysteries of the universe.)
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Fri Jun 25, 2010 2:38 pm    Post subject: Reply with quote

The movement/angles interpolation in NQ just determines the time between two intervals that messages arrive at, and isn't active when connected to a local server, so it's quite limited really.

I reckon the thing with interpolation is that it's all a matter of personal taste. Me, I hate the absence of frame interpolation, but could live without movement/angles easily enough (not saying that I prefer to switch it off - I don't, but it doesn't bother me so much if it's not available). Doesn't mean that I'm right and you're wrong, or vice-versa; just personal taste.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Fri Jun 25, 2010 3:34 pm    Post subject: Reply with quote

Spike wrote:
[offtopic]tbh, I'm not that keen on lightstyle interpolation. makes flickering lights look ugly, and the lightmap uploads/regeneration every single frame gives a biiig slowdown.[/offtopic]

I thought NQ had fully functional movement/angles interpolation already...
All but for stepping monsters, which have an explicit flag set that stops them from being interpolated so they don't slide and judder, but merely judder. Just ignore that flag if frame interpolation is active.


Son a bitch! The U_NOLERP flag. Testing ... sigh ... of course.

Spike, thank you for your priceless advice. Sheesh. Ages old mystery solved at least for me today. Grrrrrr. Evil or Very Mad
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Fri Jun 25, 2010 9:17 pm    Post subject: Reply with quote

Yup, that's the flag that I was thinking of, anyway.
mh has a point though - it depends upon your packet rate.

[offtopic]And you might as well implement lightstyle smoothing, if disabled, its only one cvar check per frame, just maybe not default it to enabled. Some people prefer it, but yeah, flickering torches. Or if you like hacks, you could interpolate based on difference between the styles, if its too different, no interpolation. The expense is in the lightmaps, not the actual lightstyle values themselves.[/offtopic]
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Sat Jun 26, 2010 1:44 am    Post subject: Reply with quote

Spike wrote:
[offtopic]And you might as well implement lightstyle smoothing, if disabled, its only one cvar check per frame, just maybe not default it to enabled. Some people prefer it, but yeah, flickering torches. Or if you like hacks, you could interpolate based on difference between the styles, if its too different, no interpolation. The expense is in the lightmaps, not the actual lightstyle values themselves.[/offtopic]

[offtopic]It occurs to me that many of the lightstyles in Quake are not actually meant to be interpolated. Maybe the slow pulses, yes, but flickering torches and strobes? No way.[/offtopic]
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Jun 26, 2010 12:31 pm    Post subject: Reply with quote

http://www.quake-1.com/docs/rendering/r_alias.c

Managed to turn it into a cvar. My software renderer code is about 98% the same as stock WinQuake and while this file alone isn't the complete implementation (a couple of small adjustments to 3 or 4 other files, 1 or 2 liners).

It gives a good illustration for a third party (i.e., not either of you two obviously, hahaha) of how I turned it into a cvar and how I can optionally simply not even compile it into the engine.

I added cl_gameplayhack_monster_lerp 1 (as default value) and sv_gameplayfix_monster_lerp 1 (as default value) into my engine [GL builds too, of course].

Combined with MH interpolation, those deliver a much better single player experience in software and at any of the 3 or 4 NQ online coop servers (killing U_NOLERP ... sigh, what a difference).

That is really some wonderful code, MH. Very Happy
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...


Last edited by Baker on Sat Jun 26, 2010 12:35 pm; edited 2 times in total
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Sat Jun 26, 2010 12:34 pm    Post subject: Reply with quote

mh wrote:
Spike wrote:
[offtopic]And you might as well implement lightstyle smoothing, if disabled, its only one cvar check per frame, just maybe not default it to enabled. Some people prefer it, but yeah, flickering torches. Or if you like hacks, you could interpolate based on difference between the styles, if its too different, no interpolation. The expense is in the lightmaps, not the actual lightstyle values themselves.[/offtopic]

[offtopic]It occurs to me that many of the lightstyles in Quake are not actually meant to be interpolated. Maybe the slow pulses, yes, but flickering torches and strobes? No way.[/offtopic]

[offtopic]Interpolating lightstyles kill 486s and non-Pentiums, so don't do it![/offtopic]
_________________
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Jun 26, 2010 12:49 pm    Post subject: Reply with quote

It sounds light it would screw up the intended look and feel anyway.

MH Interpolation Performance Results

timedemo demo1

No animation interpolation @ 320x200 fullscreen my machine: 285 FPS
With animation interpolation @ 320x200 fullscreen my machine: 281 FPS

So despite the lack of assembly and the pure C nature of the interpolation code, scarcely makes an FPS dent.

And even though the changes in r_alias.c are a bit moderate, it is still a rather light modification and --- well --- it isn't scary from a point of view of stability or compatibility. Very Happy Very Happy
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Sat Jun 26, 2010 2:53 pm    Post subject: Reply with quote

leileilol wrote:
mh wrote:
Spike wrote:
[offtopic]And you might as well implement lightstyle smoothing, if disabled, its only one cvar check per frame, just maybe not default it to enabled. Some people prefer it, but yeah, flickering torches. Or if you like hacks, you could interpolate based on difference between the styles, if its too different, no interpolation. The expense is in the lightmaps, not the actual lightstyle values themselves.[/offtopic]

[offtopic]It occurs to me that many of the lightstyles in Quake are not actually meant to be interpolated. Maybe the slow pulses, yes, but flickering torches and strobes? No way.[/offtopic]

[offtopic]Interpolating lightstyles kill 486s and non-Pentiums, so don't do it![/offtopic]

Does anybody aside from you use these regularly these days? Laughing Laughing Laughing

[ontopic]It's really kinda weird looking at frame interpolation in software Quake, isn't it?[/ontopic]
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Programming Tutorials All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group