Compositor: Difference between revisions

2,445 bytes added ,  30 November 2019
m
→‎Canvas support: add summary of prior work
m (→‎Canvas support: add summary of prior work)
Line 109: Line 109:
http://www.zaretto.com/sites/zaretto.com/files/compositor-effects-registry.pdf <ref>https://sourceforge.net/p/flightgear/mailman/message/36606242/</ref>
http://www.zaretto.com/sites/zaretto.com/files/compositor-effects-registry.pdf <ref>https://sourceforge.net/p/flightgear/mailman/message/36606242/</ref>


=== Canvas support ===
So far, we were focused on implementing camera views in Canvas. We also keep in mind that this might be an important groundwork for what might be RTT support for effects/shaders. For that we obviously need a link between Canvas and Effects. It's kind of a good thing that both systems are completely separated and don't know of each other, we are given more freedom when it comes to joining them. This link is kind of delicate and has to be well planned out. For example Hooray (and also Thorsten, but I'm not too sure) suggested per-element effects. It'd be kind of useful to have that, but would that give us the flexibility we need? Shaders can receive many input textures and modern shaders support MRT (Multiple Render Targets) too. It makes sense to come up with some kind of well defined link between Canvas and Effects that allows for inputting/outputting canvases via effects. This would allow the same things that per-element effects would allow but with more flexibility and less overlapping functionality. <ref>https://forum.flightgear.org/viewtopic.php?f=47&t=32846&#p318059</ref>
What we have now, works similarly to how Rembrandt does its buffers. There is a new texture type called "canvas" that allows shaders to access any canvas texture via a texture unit, just like you'd access a normal texture from the hard drive. This removes (most) limitations of addPlacement, which can only substitute the "base" texture (unit 0). The posibilities are endless, it just needs some care and work. At the moment we could have shadow mapping outside Rembrandt just by creating a new view placed at the Sun and make it render the depth buffer to a canvas. Then every ALS shader could access this canvas and do the shadow comparison thingy. Planar reflections in the water should be kind of trivial as well, it'd just require the model-view matrix to be multiplied by a reflection matrix and the water shader could just paste the result over the water surface (with some more fancy calculations to make it pretty of course).<ref>https://forum.flightgear.org/viewtopic.php?f=47&t=32846&hilit=canvas+view+element+offscreen#p318662</ref>
Actually, every ALS shader could choose to access this canvas - so one can run the more detailed opacity map technique in cockpit and shadow mapping outside for instance.<ref>https://forum.flightgear.org/viewtopic.php?f=47&t=32846&hilit=canvas+view+element+offscreen#p318693</ref>


=== Availability ===
=== Availability ===