On Wed, Jun 12, 2013 at 9:35 AM, Sletta Gunnar <[email protected]> wrote: > > On Jun 9, 2013, at 12:59 AM, Mark <[email protected]> wrote: > >> Hi, >> >> Yet another scene graph related question :) >> I have to say, the documentation in the scene graph department could >> really use some more docs and advanced examples! The code leaves a lot >> of guess work and there isn't much to find since this tech is quite >> new. > > I know, I'm adding stuff as time permits :) > >> >> Anyhow, I want to apply a shader to my flat material. >> QSGFlatColorMaterial has a createShader() method that return a >> QSGMaterialShader, but then what? > > You set the material on the geometry node and the rest happens internally. > >> Also, how can i set multiple shaders on one material? > > You don't. You can use two different geometry nodes which share the same > QSGGeometry but have different materials (see the code in the example I > posted in the other thread). Or you can have one QSGGeometryNode which > reimplements QSGNode::preprocess() to switch the material at runtime just > before it is drawn. > >> since the flat >> material i'm talking about now needs two. One for antialiasing >> (playing with that [1]) and one for drawing a shadow. > > This is algorithm is applying a post-filtering effect on the entire scene > after it is rendered. This is not something you do with just nodes in > scenegraph. > > If you want to apply this for the whole window you should use > QQuickWindow::beforeRendering to redirect the QQuickWindow to an FBO using > QQuickWindow::setRenderTarget(). Then you can use > QQuickWindow::afterRendering() to apply the FXAA filtering to that FBO as you > draw it to the screen. > > If you want to do this inside QML, you can also do that using a > ShaderEffectsouce and ShaderEffect on the graph element. Then the > ShaderEffectSource will do the rendering to the FBO and the ShaderEffect will > apply the post processing. > > But I do suspect that text and single-pixel horizontal/vertical lines will > look rather ugly afterwards :) > > cheers, > Gunnar > >> >> Cheers, >> Mark >> >> [1] >> http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf >> _______________________________________________ >> Interest mailing list >> [email protected] >> http://lists.qt-project.org/mailman/listinfo/interest >
Awesome, i think i'm just going to stick with your new example code and continue from there on. That seems to the way to go anyway. Your example just made it a lot more accessible for me :) _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
