20,741
edits
(CompositeViewer+Canvas) |
m (add shuttle related pointers to illustrate that the shuttle devs have been wanting to use this for years to implement CCTV/RMS camera support) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
|sponsor=[[User|Cgdae]] | |sponsor=[[User|Cgdae]] | ||
|supporters= | |supporters= | ||
|status=several years ago, people on the forum came up with a working proof-of-concept patches implementing experimental support, predating Compositor/CompositeViewer support: [[Canvas_View_Camera_Element#Proof_of_Concept]] | |||
|summary = make it possible to render arbitrary scene views to a canvas, so that the canvas can be reused to implement modern avionics (exterior views, synthetic terrain, shuttle RMS arm/END EFF mode <ref>https://forum.flightgear.org/viewtopic.php?f=87&t=25747&p=282898&#p282898</ref> <ref>https://forum.flightgear.org/viewtopic.php?f=87&t=25747&hilit=&start=2160#p326104</ref> etc) <ref>https://sourceforge.net/p/flightgear/mailman/message/37147262/</ref> <ref>https://forum.flightgear.org/viewtopic.php?f=87&t=25747&hilit=&start=2160#p326182</ref> | |||
This feature would also make it possible to configure views, and windows, in-sim - i.e. while providing "live" preview. | |||
|background= | |background= | ||
[[CompositeViewer_Support|CompositeViewer]] allows us to create multiple windows showing different views of the same scenery. | [[CompositeViewer_Support|CompositeViewer]] allows us to create multiple windows showing different views of the same scenery. | ||
We should be able to extend CompositeViewer to render these different views of the scenery to Canvas elements instead of top-level windows. Then if these canvas elements are displayed in a cockpit we will get things like tail cams, gear view and rear view mirrors. | We should be able to extend CompositeViewer to render these different views of the scenery to [[Canvas_Sandbox#CanvasCamera|Canvas elements]] instead of top-level OSG windows. Then if these canvas elements are displayed in a cockpit we will get things like tail cams, gear view and rear view mirrors. Which is a long standing feature request: [[Howto:Use a Camera View in an Instrument]]. | ||
|details= | |||
|skills=C++ | The original set of patches (touching SimGear and fgdata) implements a new Canvas::Element by creating a sub-class named Canvas::View. The meat of it is in the constructor, i.e. Canvas::View::View(), where an off-screen camera (RTT/FBO) is set up, the FGCanvasSystemAdapter file has been extended to provide access to the FlightGear view manager to compute/obtain the view-specific view matrix, which is then used by this new canvas view element to update the offscreen camera in Canvas::View::update() accordingly. | ||
BTW: This is also a good way to stress-test the renderer, as new cameras can be easily added to the scene at runtime, so that the impact of doing so can be easily measured. | |||
the patch is experimental, it will basically look up a view and dynamically add a slave camera to the renderer that renders the whole thing to a Canvas, a Canvas is a fancy word for a RTT/FBO context in FlightGear that can be updated by using a property-based API built on top of the property tree in the form of events/signals that are represented via listeners.Which is to say each Canvas has a handful of well-defined property names (and types) that it is watching to handle "events" - think stuff like changing the sie/view port etc. And then there is a single top-level root group, which serves as the top-level element to keep other Canvas elements.A Canvas element is nothing more than a rendering primitive that the Canvas system can handle - e.g. stuff like a raster image can be added to a Canvas group, a text string/font, and 2D drawing primitives in the form of OpenVG instrutions mapped to ShivaVG. And that's basically about it (with a few exceptions that handle use-case specific stuff like 2D mapping/charts).Apart from that, the main thing to keep in mind is that a Canvas is really just a FBO - i.e. an invisible RTT context - to become actually visible, you need to add a so called "placement" - this tells the rendering engine to look up a certain canvas and add it to the scene/cockpit or the GUI (dialogs/windows). | |||
|details= [[File:Canvas-view-element-prototype-by-icecode gl.png|thumb]] | |||
* [[Canvas Sandbox]] | |||
* [[Canvas Development]] | |||
* [[Canvas View Camera Element]] | |||
|skills=C++, [[OpenSceneGraph]] 3.6 | |||
|opportunities= <p/> | |||
* Canvas | |||
* CompositeViewer | |||
* Compositor | |||
|notes = It would make sense to reach out to Jules (CompositeViewer) and Fernando (Compositor) to learn how to best approach this today. | |||
The basic boilerplate needed to add/register a new Canvas element can be seen below: | |||
{{Custom_Canvas_Element | |||
|baseclass=Image | |||
|elementName=Model | |||
|elementTitle=Canvas Model | |||
|description=Stub for exposing OSG/SG model loading support as a dedicated Canvas element | |||
|file=Models/Aircraft/HR200-ba.ac | |||
}} | |||
}} | }} | ||
[[Category:Canvas Element Proposals]] | |||
[[Category: |