Board index FlightGear Development Canvas

Gear view in cockpit computer

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Re: Gear view in cockpit computer

Postby Johan G » Sat Aug 26, 2017 5:00 pm

Hooray wrote in Sat Aug 26, 2017 1:08 pm:Here's a PM I recently received from F-JJTH (former FG core developer), I am reposting this in public to share his patches with others, and to "thank" him, too [...]:

F-JJTH wrote:[...]

If you read a bit the code you will understand how it works:
- On 3D side you just need to assign the texture "Aircraft/Instruments/Textures/camera-display.rgb" to the object you want display the camera
- On FG side, you must create a <camera-display> instrument in your instrumentation.xml
- All views defined by the aircraft author are available in the display
- You can control the camera position/orientation by modifying the property tree /sim/view[n]/ ...

That seems interesting. Rear view mirrors in fighters could become a reality, as well as camera displays in SAR helicopters, outside views in airliners, backing view displays in cars etc.

Can there be only one view or many?
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5294
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 5:25 pm

I haven't (yet) actually had the time to review/test F-JJTH's patch - however, conceptually, there should be no reason why this should be restricted to a single view only - in general, this should work for most slaved views. Everything else (aka independent master views) would require CompositeViewer support, as per: http://wiki.flightgear.org/CompositeViewer_Support

Note that this patch seems overlapping with Zan's original "new-cameras" effort, as mentioned at: http://wiki.flightgear.org/Canvas_Devel ... ng_Cameras

If this patch should work well enough, it would probably make sense to integrate it with the Canvas system to come up with a dedicated "camera" element for the Canvas system, that would be configurable using the format/properties used by the view manager: http://wiki.flightgear.org/Howto:Config ... FlightGear

At that point, it would actually be a terrific idea to review Zan's original patches and see if any of the features there could/should be integrated with the new Canvas::Camera element - like you say, once this is properly working, "the sky is the limit" (or not even that, think shuttle cams) :mrgreen:
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 5:47 pm

Well it works ;-)

However there are some bugs with my first attempt.
The image jumps all over the place when the aircraft is moving.
The colours are wrong.
Not having read the code I do not yet know how to change view.

Alan
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 5:55 pm

Thanks for testing and reporting back here.

According to your description it sounds like the way of updating the texture/buffer is not the most appropriate one, and maybe the texture/color buffer itself isn't adequate either ?
Given that we're now in OSG land, I would expect some kind of post-render callback to be registered to handle this, analogous to how the screenshot/streaming handlers are implemented (think Torsten's mongoose related work to this).

So if anybody is interested in working out what is missing or what can be improved, my suggestion would be to review working features doing similar things, e.g. the screenshot/streaming handlers or the camera setup routines used by CameraGroup.cxx itself.

As far as I know, Icecode GL and abassign have recently been doing experiments related to this, so maybe if they find a little time to review this patch, the whole thing can be polished a little more ;-) ?

PS: Maybe you could post a few screenshots or even a video ?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 6:29 pm

The colours are wrong with Rembrandt. It looks as if the wrong buffer is being used.
Jumping around is the same with and without Rembrandt.
Here are some screenshots from the rear cockpit of TSR2. The image is just to the left of the moving map.
I am flying (hands off as I am in the rear cockpit) more or less straight and level and the image camera point can be seen to jump around between screenshots. The last 2 images are with Rembrandt.

Image
Image
Image
Image
Image
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 6:39 pm

Thank you very much for posting these images, that's very helpful !
To be honest though, I wouldn't expect such patches to immediately work with something like "Rembrandt" (or even ALS/osgEarth), given that this is adding functionality (new camera/viewer positions) that neither of the default renders were designed in mind with.
I guess, before looking at some of our most advanced use-cases, it's best to tinker with a really simple scenario, to see how well this works, and what needs to be polished.
The "jumping" you mentioned should be straightforward to fix, once we begin reviewing the code - like I said, the usual way of dealing with a rendered camera is to register a post-processing callback - we also used that to implement a screenshot handler for streaming arbitrary Canvas textures to a browser, using the code shown at:

http://wiki.flightgear.org/Read_canvas_ ... TP#Patches
Image

Conceptually, this code needs to do pretty much the same thing.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 6:44 pm

Okay, been looking at some of the code, and it seems it's using the standard view-manager interface, so you primarily need to set the view-number property to change the view (untested, feedback is just based on looking at the patch in question).


Specifically, when running the patched fgfs binary, look for:

/instrumentation/camera-display and the view-number property underneath


From a coding standpoint, it seems to be using the legacy bind/unbind APIs, i.e. so called "tied properties", whereas it should ideally be using proeprtyObjects instead.
Other than that, it's looking pretty straightforward actually, so should certainly be possible to improve/optimize this and integrate it with the Canvas system.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 6:55 pm

Thanks for that.

The jumping around effect seems to be in all views. The control tower view jumps back and forward, showing the whole tower at times.

Alan
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 7:00 pm

Looking at the way the OSG handling is done, I think that Clement may have simply stopped at this point, i.e. he was merely interested in getting a prototyping working (which he succeeded at!), but other than that, the patch needs some TLC - however, it's definitely a very solid foundation, and very compelling as a prototype, especially given that the patch is pretty lightweight.
Much of the OSG machinery to set up the FBO/RTT (render to texture) is overlapping with Canvas functionality, so we could do away with that by using a dedicated Canvas element (which may fix some issues, e.g. colors being off).
Besides, if/when we actually use the approach used by Torsten's screenshot handler routines (mongoose/Phi), the "jumping" may also be gone (just a guess).

At this point, we need to get more people involved who are able to patch/rebuild sg/fg from source and test these patches, so that we can come up with a team of folks to help with testing/developing. I can certainly help with the Canvas side of this, which means that the FBO/RTT setup routines can be simplified, and I can help turn the whole thing into a dedicated Canvas "camera" element.

So, my suggestion would be to reach out to folks who've previously expressed interest in such functionality and see if they're currently available for testing/helping with this. To add some TLC to the code, so that we can prepare a merge request.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 7:07 pm

Actually, looking at your description and the two screenshots, I disagree with my last comment: if the cam shows a different view in different frames, I guess that something else is going on - if in doubt, I'd suggest to add SG_LOG(); statements to the code to dump the view details to the console (or even to properties) - assuming that none of the view parameters changed in between frames, it may be using an old view matrix or other variables that were not updated (yet), so that it's merely trying to catch up.

If that's the case, that it's unrelated to the GL setup routines, and it would most likely have to do with the view manager updates not being in sync with the camera updates - which is something that OSG can easily deal with by registering a cam is being pre- or post-rendered, i.e. after the scene has been rendered, or prior to it being entirely rendered.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 7:20 pm

The patch seems not to break anything else, and does nothing unless the aircraft side code is added. It is therefore reasonably safe to add the patch to your working copy of FG. No git branch expertise is required.

Alan
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 7:48 pm

Yes, thanks - I do understand what it is doing, it is using the approach I originally outlined in the wiki, when I helped create the Howto:Use a Camera View in an Instrument article. So I fully understand that it only has an effect if the aircraft actually instantiates/references the new "camera-display" instrument added by F-JJTH.

When I asked for screenshots and testing, this was primarily because I haven't built FG in a while, and don't currently have much time for anything involving FG, which is why I am rarely posting on the forum these days. However, I am still interested in helping with that. That said, I don't think that the approach I originally suggested should be used these days, coming up with a custom Canvas element would be far more appropriate, while also helping simplify the corresponding patch.

But for that to happen, some of the more obvious bugs would need to be identified, understood and fixed first.

Thus, my comments were not due to safety concerns or lack of git expertise. Thanks anyway.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 7:54 pm

On the other hand, I am out of my depth with GL etc..
Alan
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Gear view in cockpit computer

Postby Hooray » Sat Aug 26, 2017 8:00 pm

As usual, my suggestion would be to update the wiki accordingly, to add the patch we now have, including your screenshots and adding a list of known issues, as well as a list of potential improvements - as can be seen once again, these things actually do work out (well, over time obviously).

While it may seem redundant and unnecessary to document such "progress" using the wiki, doing so does serve a purpose, and it is much also more user-friendly to point people to a corresponding wiki article with all the info nicely summarized and presented, rather than telling people to "search the archives ... and good luck at that".

As a matter of fact, even the Canvas system itself came to be like this, roughly 2 years after having been added to the wiki as a proposal, all implemented by someone "external" to the project at the time, without any core developer endorsement or support during the prototyping stage.

Thus, if this (custom camera views) is something that any of you are interested in, I would strongly suggest to give this a try. F-JJTH has certainly provided a solid foundation, and I would not underestimate the power of documenting the current state, adding screenshots, the patch itself and any related pointers.

EDIT: I have updated the wiki by adding this to the Canvas News section at: http://wiki.flightgear.org/Canvas_News# ... ve_Cameras
It would probably also be a good idea to add related screenshots/videos to get more people involved.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11263
Joined: Tue Mar 25, 2008 8:40 am

Re: Gear view in cockpit computer

Postby Alant » Sat Aug 26, 2017 10:07 pm

I am slightly at odds with you here as I believe that the wiki is the place for finished articles. When I look for guidance I look in the wiki, and do not expect to instead find lots of (usually outdated) proposals. This is very irritating to me.

The forum is a better, more dynamic, place for development issues.

When something is released, or about to be released, that is the time for a wiki article.

However I do see an advantage in putting links from the wiki to forum (and the devel email list) topics, so that readers can see, and perhaps contribute, to new advances. That is what I will do in this case.

If you really think that proposals should be in the wiki, my view is that they should be in a well defined and separate section of the wiki, so as not to confuse folk who are trying to find out how to do" X" with Flightgear.

Alan
Alant
 
Posts: 761
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

PreviousNext

Return to Canvas

Who is online

Users browsing this forum: No registered users and 4 guests