Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Deimos on November 25, 2007, 08:30:01 pm

Title: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on November 25, 2007, 08:30:01 pm
Hi, I've been lurking around these boards for quite a while, and i must say I'm simply amazed by the progress made by SCP team since the retail game - Thanks for all your great job :D

And getting to the point - since there already is some basic cockpit functionality available, and there seem to be more advanced versions of it on the way, the ability to use some head tracking equipment to control player's point of view in freespace would be great.
There's already been some questions about TrackIR support in the past, but the strongest argument against that was trackIR's price - it's a quite expensive toy. However I've found an alternative to trackIR lately - it's called Freetrack:
http://www.free-track.org/english/
Basically, it offers the same functionality as TrackIR, but the software is free, open source, and all you need is a webcam, a few LED's, and some time to put together a headphone clip, or a cap that would allow to track your head movement, for example something like this:
(http://www.bsk.vectranet.pl/~lachrafal/misc_images/LabtecIR/cap_small.jpg)
And you can enjoy full 6 degrees of freedom head tracking, and to make things even better - it's compatibile with most TrackIR-supporting games. With a correct setup it works like a charm. I've been using it for a while in flight sims, but I'd really love to be able to use it in freespace once the cockpits are in.
I've heard some people complain about cockpits obstructing their view and say they usually disable them. But believe me, there's nothing like sitting in a cockpit of eg. helicopter and being able to look down on your MFD, by simply tilting your head down, zooming the view by moving your head closer to the monitor, being able too peek above the instruments panel by straightening up in your chair, or moving closer to the window of the cockpit to be able to look below the helicopter - all by just moving your head. It's something you just need to try to be able to fully appreciate.
Here are some videos of freetrack in action:
http://www.youtube.com/watch?v=R3FXBhEmLWM
http://www.youtube.com/watch?v=PwHX4wY1nyo

And if implementing real freetrack/trackir support is too hard or there are more features with higher priority then how about at leas adding the ability to bind cockpit POV movement/rotation to joystick axes? Both Freetrack and trackir can output head position data as a virtual joystick.

By the way, I know there's been some discussion about trackir in the past, but there wasn't a separate tread about it, and i didn't want to hijack some other treads, so i decided to post a new one.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Herra Tohtori on November 25, 2007, 08:54:15 pm
Woo, DIY-TrackIR! I'm just wondering - how accurate is this system actually with 640x480 (VGA) resolution webcam, and does the software compensate (and if yes, how well) for the typical low FPS speeds of (especially cheaper) webcams, or do I need to get a 50€ webcam before getting smooth and accurate end results?

At any rate, I'll have to check this out, thanks for the informative post!
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on November 25, 2007, 11:26:10 pm
before i bought my track ir i was using a software called cam2pan which was a total piece of crap in my opinion (or rather my webcam). anyway framerate is important, the camera needs a high fps. color depth is not important. i think the track ir is only a 1 bit camera with an infra red filter. in theory you could take any high performance webcam, stick an ir filter over it and use ir leds. the proper decoding software is important, you need to reverse-project the blips fast enough to provide axial deta and also keep it in good calibration. track ir's software is really good at this. this freetrack is rather impressive. can it utilize the track ir hardware?

as for the cockpits, ive been doing some experimental virtual cockpit features with lua scripting. heres a demo of what ive done so far:
http://www.youtube.com/watch?v=-PM69ICOhsE

its buggy but it works.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on November 26, 2007, 06:07:07 am
Freetrack is quite accurate with any camera running 320x240 (you actually don't really need to go to to 640x480, even if you can) @ 30FPS - most of them can do this, even the ones for ~10EUR . The movement is really smooth when all the LEDs are clearly visible to the camera. And they are they're bright enough and there isn't much sunlight shining directly at the picture background, or if you use some infrared LEDs and swap IR filter present in all webcams for visible light filter - then it works perfectly even in brightly lit room. Here's a captured frame from my IR-modified labtec webcam - 320x240, 30FPS, minimal exposure and gain setting, brightly lit room:
(http://www.bsk.vectranet.pl/~lachrafal/misc_images/LabtecIR/Picture3.jpg)
(sorry for image artifacts, a bit too much compression :D )
Anyway, if you're interested in trying it out, make sure to check this forum:
http://freetrack.online.fr/forum/index.php?showtopicgroup=8

Also, the head movement is constantly being filtered, so you don't have to keep your head exactly still to look in one place, but all actually intentional movements are easily being picked out, you can also set deadzone and sensitivity to your liking. Really, it's worth giving it a try, especially if you own a webcam - it doesn't take much effort to build a tracking clip, and using it is a lot of fun :D

Freeetrack is really high quality open source software - all the more important for other high quality open source project - FSO to support it :D

Nuke - that looks simply amazing, and great cockpit model too :) By the way - maybe head tracking possibility should be considered when modeling cockpits, so that they have all the walls in place?

[EDIT]
Just noticed - there's a nice article on wikipedia with some tech details, pros and cons of Freetrack.
http://en.wikipedia.org/wiki/FreeTrack
[/EDIT]
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on November 26, 2007, 07:14:24 am
unlike most ships in the game i designed my cockpits from the start to be visible from the inside. most were just modeled for external views. nukemod has several cockpitted ships. the chimera, the satyr, the sepulture (in video), the shagrath, the phoenix all have cockpits and im currently working on revisions of the seker, and vulture which will include cockpits and normal maps. im also contemplating doing a full bridge for the rumrunner and all the ragnarok varients. my long term plan is to include cockpits with fulling working panels and animated flight controls in alll nukemod ships. and to be able to look around with head tracking hardware.

il post my lua script after i smash a few more bugs.

head tracking is definately something i enjoy messing around with. im curious about using other weabcams perhaps as hand trackers, using different colored leds so as not to cause any cross-interferance. parhaps add the possibility of reaching out and flipping switches on the panels and manipulating other controls. one thing i was disapointed in with the track ir was how everythnig was proprietary. no linux support and no build in joystick emulation (though ive recently discovered tir2joy). all the config apps for my ch gear and my head trackers take up a rather large chunk of my processing power. usually running ppjoy, trackir, and ch control manager all at once on some games (mechwarrior 2 for example). most of the time im still at the mercy of the game's input code.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: colecampbell666 on November 26, 2007, 08:03:32 am
Nuke, why don't you join the SCP? Or do you not know C++?

This FreeTrack thing looks cool, though it would probably be too much for my PC. I think that my camera could handle it, though.

And
:welcomeorange:
Deimos!
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on November 26, 2007, 09:15:43 am
i know enough c++ to write a simple line drawn 3d game engine. the problem is that freespace is mostly written in c, and im not so good at c. i looked at the code once and it traumatized me for life. its probibly alot cleaner now but still, the memories, the horrid memories :D
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on November 26, 2007, 11:18:49 am
3D bridge on a starship - aaah, that brings sweet memories of my Boron Ray from X2 :D Would be nice to be able to sit on a bridge with working panels and indicators in freespace, and to be able to use head tracking in them :)

@colecampbell666 - I don't know what you computer is, but on my Sempron 2800+ it takes 2-5% CPU power (usually closer to 2).
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: colecampbell666 on November 26, 2007, 11:26:44 am
P4 @ 1.5 Ghz.

What we need is fully humanoid AI for every person/Shivan/Vasudan in the game. It might be a few petabytes, at the most.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: jr2 on November 26, 2007, 01:45:00 pm
This looks cool.
/me does want.

(http://i15.tinypic.com/873sl76.png)
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Swifty on November 26, 2007, 01:48:57 pm
Right now, the BTRL project has a TrackIR SDK from NaturalPoint. I'm currently working on implementing TrackIR support in the game. So far, I've gotten freelook views to work independently from the ship controls (Nuke seems to have done it as well) and so now I'm working on creating a DLL that will abstract all the calls to the TrackIR drivers (Since NaturalPoint won't allow us to make explicit calls to the NaturalPoint client DLL visible to the public).
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on November 26, 2007, 01:52:38 pm
id rather have it work in c than in lua. also my implementation is stuck with using mouse emulation so i dont get 6dof. also the refresh is framerate dependant.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on November 26, 2007, 03:03:48 pm
can it utilize the track ir hardware?
Sorry, but somehow i missed this question before. If by hardware you mean the trackir 3-point headphone clip, it should work without problems, you'd just have to measure it and input its dimensions into the software. With 3-reflector cap clip (vector extension, or whatever they call it) you would need a few strong IR LEDs illuminating you, and a camera with removed IR filter or else it won't pick the reflected light (and some measurements again). Same thing with 1-point reflective cap, but i don't know why would anyone want to use 2DOF control if they can get 6DOF almost as easily.
If by hardware you mean the TIR camera, right now it doesn't work with it. From what the main freetrack developer says, it could, but he doesn't have TIR hardware, so he can't test or develop it.

colecampbell666 - Your computer should handle it , but i guess you should simply try and see how much CPU power will it take. You can always take 3 flashlights attached to something in trinaugular formation, measure distance between bulbs, input them into FT sowtware ans see how it runs (minimize and see CPU usage in task manager - it has much more CPU usage when its window is open). If its performance is satisfactory, you could try building a LED clip...
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on November 28, 2007, 10:55:43 am
i recorded another video. this time i added a gunsight.
http://www.youtube.com/watch?v=QEu60IjiGfI
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: jr2 on November 28, 2007, 11:05:38 am
@Deimos, you like over torquing those engines, eh?  XD
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: n0s on November 29, 2007, 03:49:31 pm
thanks for the infos, looks awesome.

finally, i've got a good reason to buy a webcam^^
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: WMCoolmon on December 01, 2007, 02:01:33 am
Right now, the BTRL project has a TrackIR SDK from NaturalPoint. I'm currently working on implementing TrackIR support in the game. So far, I've gotten freelook views to work independently from the ship controls (Nuke seems to have done it as well) and so now I'm working on creating a DLL that will abstract all the calls to the TrackIR drivers (Since NaturalPoint won't allow us to make explicit calls to the NaturalPoint client DLL visible to the public).

Will you be committing the the code for the FS2_Open exe to CVS?
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on December 01, 2007, 03:46:09 pm
i think the rules are the dll must be closed source, but the interfaces to that dll can be open. the dll code itself would be seprate. really theres nothing that says that you cant put the interface to the dll into cvs. even if only btrl is allowed to use the dll, theres really nothing that can stop users from dropping the dll into the freespace dir.

then again theres nothing stopping you from getting youre own sdk. im sure natural point wouldnt mind adding another title to the compatability list.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on December 01, 2007, 05:07:31 pm
@Deimos, you like over torquing those engines, eh?  XD
Not my movie ;) Actually, i thought the same about the guy who posted it :D
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: WMCoolmon on December 01, 2007, 07:31:37 pm
i think the rules are the dll must be closed source, but the interfaces to that dll can be open. the dll code itself would be seprate. really theres nothing that says that you cant put the interface to the dll into cvs. even if only btrl is allowed to use the dll, theres really nothing that can stop users from dropping the dll into the freespace dir.

then again theres nothing stopping you from getting youre own sdk. im sure natural point wouldnt mind adding another title to the compatability list.

Based on the process that BtRL had to go through to get TrackIR support, I'm pretty sure they would frown on another mod just tossing the DLL into their own game files, or if it were widely distributed with FS2_Open itself, unless somebody contacted them about using it.

I was working on the TrackIR stuff for BtRL at one point, so I did have access to the SDK.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Objekt on December 10, 2007, 09:25:02 am
First: Holy CRAP!!  That looks awesome!  And which mod is that where you're doing the head-tracking demos?  I've never seen those ships before, or that funky planet-with-vapor-trails or whatever it is in the background.  It's only recognizable as FS-related because of the HUD-elements.

Second: What is that helicopter sim where the guy is constantly overtorquing the engines?  I wasn't aware there was anything quite that advanced on the market, including such detail of Russian helos. 

Third: Of what use is head-tracking without a head-mounted display? I don't see what good it does me for the computer to swing the viewpoint around 90 degrees, because I won't be looking at the monitor anymore.  If I look up, I'm going to see the ceiling, not whatever's on the monitor.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: jr2 on December 10, 2007, 09:28:34 am
They have head-mounted displays coming pretty soon... there are versions that fit like a pair of glasses, in fact... I'll have to dig up those articles for you.

EDIT: here (http://www.popsci.com/popsci/whatsnew/e617b4a35b56d010vgnvcm1000004eecbccdrcrd.html).  (Be sure to view all 3 images in the slideshow.)

EDIT2:

Vuzix (formerly Icuiti) (http://www.icuiti.com/index.html) (first picture in slideshow)

Lumus glasses (http://www.lumus-optical.com/) (second picture in slideshow)

VRD (http://www.hitl.washington.edu/research/vrd/project.html) (third picture in slideshow)
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Objekt on December 10, 2007, 09:37:12 am
I hope the new generation HMDs are better than the crap they sold in the mid- to late 1990s.  Those were awful: low resolution, low feedback, enough lag between head movement and display update to induce spatial disorientation.  Remember the whole "virtual reality" craze that pretty much went away shortly thereafter?  Lack of decent HMDs was a big reason. 

Nowadays, I'd like to think we have enough processing power on our desktops to do it up right.  It wouldn't even have to be stereoscopic.  I would settle for a 1024x768 display, projected to a virtual 50" or so screen size, with at least 30 FPS.  Even 640x480 at 30 fps, with stereoscopic projection, would be pretty neat.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: jr2 on December 10, 2007, 09:42:37 am
See linkies in my EDIT2:, above.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Deimos on December 10, 2007, 05:35:33 pm
Second: What is that helicopter sim where the guy is constantly overtorquing the engines?  I wasn't aware there was anything quite that advanced on the market, including such detail of Russian helos. 
That's Enemy engaged: Commanche vs Hokum / Apache vs Havoc (both games integrate into one), with community patches and mods.

Third: Of what use is head-tracking without a head-mounted display? I don't see what good it does me for the computer to swing the viewpoint around 90 degrees, because I won't be looking at the monitor anymore.  If I look up, I'm going to see the ceiling, not whatever's on the monitor.
It's simple - the head movement is amplified - so for example when you turn your head 30 degrees, the game camera turns 170 degrees. Sensitivity and responsiveness can be adjusted in software to personal preference. You can set it so that small head movements are amplified only a little, and therefore very precise, but larger movements will become more amplified, allowing you to look sideways and back without loosing tracking precision around the center. Personally i prefer linear characteristics, without any deadzone, but it's just a matter of personal preference.
The Freetrack/TrackIR head tracking implementation is really intuitive once you get the hang of it, and works really well, even without HMD's. At first, i wasn't convinced of its usefullness as well, but after trying, i wish that every game supported it :D
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Objekt on December 10, 2007, 06:47:44 pm
ooookay.  That sounds kind of weird, but I suppose one could get used to it.

Having a large, widescreen display would probably help.  I'm near upgrading to a 22" or 24"-diagonal widescreen LCD for my primary display.  I'm leaning toward 22", what with the huge price increase in going from 22" to 24".
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on December 10, 2007, 07:22:01 pm
First: Holy CRAP!!  That looks awesome!  And which mod is that where you're doing the head-tracking demos?  I've never seen those ships before, or that funky planet-with-vapor-trails or whatever it is in the background.  It's only recognizable as FS-related because of the HUD-elements.

the mod is nukemod (go figure), and can be had here (http://www.game-warden.com/forum/showthread.php?t=2214). be advised thats an old version and doesnt include the camera script. next version will have some more models with cockpits and perhaps some demo scripts (assuming i can take all the bugs out of em).

They have head-mounted displays coming pretty soon... there are versions that fit like a pair of glasses, in fact... I'll have to dig up those articles for you.

EDIT: here (http://www.popsci.com/popsci/whatsnew/e617b4a35b56d010vgnvcm1000004eecbccdrcrd.html).  (Be sure to view all 3 images in the slideshow.)

EDIT2:

Vuzix (formerly Icuiti) (http://www.icuiti.com/index.html) (first picture in slideshow)

Lumus glasses (http://www.lumus-optical.com/) (second picture in slideshow)

VRD (http://www.hitl.washington.edu/research/vrd/project.html) (third picture in slideshow)

i was actually looking at the vuzix vr9200 the other day on the flightsim.com pilot shop. while modern computers are fully capable of driving high res stereoscopic displays, and run head tracking systems such as the track ir (and both quite well). the only thing really missing is the hmd (and nvidia needs to update their stereo drivers too :D ). this one is ok but it could be better. for example it could be made wireless and use higher res screens. a pair of 800*600 screens would be nice, at least then you could get some vertical resolution. im pretty sure such lcds exist for things like video projectors. 

to drive a stereoscopic 800 * 600 display @ 24 bit, 60 fps would require a 173 MB/sec (111 for 640*480) one way transfer rate. thats alot of throughput, enough to overload any current wireless technology. you could probably transmit the data as analog or use compression. dxt1 compression would reduce it 8:1 and bring it down to 21.6MB/sec (640*480 it would be 13.9 m/s). this would allow the video to be sent with wifi, bluetooth (unlikely) or wireless usb (maybe, i havent seen the specs). a transmitter station would need to be connected to the video card and probibly require its own power.

the main problem with most hmds is they try to do too much. i find alot of units with earbuds and with motion trackers built in. all it really needs to do is be a stereoscopic display. a good surround system and camera based motion tracking. for sound the game needs to get player position and orientation data and factor that into 3d sound rendering. for tracking, i find single camera tracking works so long as you face a general direction. if you mount the camera high and at an angle, and use bright leds for markers, you will greatly increase your range of motion. id like to see a stereo tracking camera, or single camera array. but more cameras and more markers = more expensive, and more complicated software.

eventually id like to play an fps game, by standing in the middle of the room with a gun shaped controller that worked like a gun works, having its orientation and posotion tracked. as you move it around the gun in the game moves. you can turn around to face any direction. when you jump your character jumps and when you crouch or go prone your character does likewise. if you take a couple steps forward from the middle you walk forward and stop when you return to the middle (a human joystick approach that keeps you from running into the walls). when you attack an enemy you actually have to aim your weapon and you could look down the iron sights in the game. this is what i want. all with no wires and with your computer off in a corner.

ooookay.  That sounds kind of weird, but I suppose one could get used to it.

Having a large, widescreen display would probably help.  I'm near upgrading to a 22" or 24"-diagonal widescreen LCD for my primary display.  I'm leaning toward 22", what with the huge price increase in going from 22" to 24".

its easy to get used to if you use it all the time. its really only useful for controlling a view within a cockpit environment, ive seen fps implementations but ive never tried it that way. you could run 3 monitors in an arcing configuration which would be totally awesome. there are also video domes out there, while expensive they give you a full wrap around screen thats pretty sweet.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Objekt on December 10, 2007, 07:34:22 pm
Certanly, we'll have to have virtual cockpits, or some way of seeing parts of your own ship, for this to be useful in FS.  You need some kind of visual reference to know where you're looking.  I'm thinking of the "padlock" view found in some combat flightsims, since at least Falcon 3.0.

Having 3 displays would be killer, but neither my computer desk nor budget will support it. 8)
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: n0s on December 15, 2007, 02:36:12 pm
@ nuke, if u could fix the bugs, would it be possible to implement the script into fs scp? maybe it could be enabled through a launcher flag or so...
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: Nuke on December 15, 2007, 08:10:08 pm
id like too but i really dont have a clue how freespace works on the inside. i like to think the coders are already working on such things. better input, native track ir etc. the camera script isnt that complicated. only thing stopping it is the fact that its unscriptable under the stable branch. that too is something thats being worked on. things like the clipping plane with scripted cameras are completely out of my control.
Title: Re: Trackir/Freetrack/analog viewpoint movement support?
Post by: n0s on December 18, 2007, 03:00:13 pm
ok  :D