[Interest] Qt3D Stencil example?

Gil H qt at tastytech.ca
Mon Sep 25 22:25:33 CEST 2017


Thanks very much for the example, Sean.  It’s much clearer now that I see RenderStates in use (for some reason I thought they only applied in Effect)…

There is a pretty serious issue that is blocking me from using Qt3D for augmented reality, which is that QtMultimedia’s VideoOutput doesn’t work when the window surface uses CoreProfile (tested on Mac).  This issue was given a low priority and is a year and a half old: https://u5810871.ct.sendgrid.net/wf/click?upn=RgE1ASyOg54bH5KXOAIcDCNgCWqccrQ-2FpQuIrXIrfIJMy2TtuL9LVEN2mNDqCmUOgEyuwohNEwt6hzEhA36JiQ-3D-3D_wBwg3POqus3ycpk-2F0rxnkTh6GGX9m8uP6qHpajPv1FEqh6WFzqVsUSHUCdA-2BOqQYKo2R18TsAPAgMZjZ6A-2FM4U6WJnaOkGJxNWR4KicbxdQdC6786gVblgUviLccyhvIpdD-2BkA71HbGmYT5QFX2aFDmXO7E20GBfRlbnRM7NWG6ojJiCN5kpbQtvBboIHkFMI5Tsp1XKcf0z1BUkFrlLbHa-2BJlA8eQGlDKDhKJcwMKs-3D

Cheers,

Gil

On 2017-09-23, 7:22 AM, "Sean Harmer" <sean.harmer on behalf of sean.harmer at kdab.com> wrote:

    Hi,
    
    On 20/09/2017 18:43, Gil H wrote:
    > Hi everyone, between StencilMask, StencilTest, and StencilOperation QML
    > items and their sparse documentation, I have been unable to achieve
    > something fairly straightforward with a custom framegraph.
    
    The render states work in exactly the same way as raw OpenGL states just 
    in an object oriented fashion. A nice page with a stencil example is:
    
    https://u5810871.ct.sendgrid.net/wf/click?upn=RgE1ASyOg54bH5KXOAIcDFYXmPTHFqeoF2wSuQEunwWDSxtesUqiG-2FgN-2BSdVCPuz_wBwg3POqus3ycpk-2F0rxnkTh6GGX9m8uP6qHpajPv1FEqh6WFzqVsUSHUCdA-2BOqQYKo2R18TsAPAgMZjZ6A-2FM4YMOVTBDEAM-2Br0R3h6mOurpsacDIqxI15OsfB3PV-2B6lxAP1emuhCZmmCFiSBd-2FOvOSw8-2FPtkkzJbzCK3mwgnzX63ZNn2-2FZalCel4DsnTFwO7wtRM-2Fwx-2FLYZuBPYL4cRj7w9b0Ys-2BCPkvhdmcb6VTfJA-3D
    
    > Specifically, I am trying to render one object (say, a torus) to the
    > stencil buffer, and then use that to mask out the rendering of the rest
    > of the scene in the second pass.  Can anyone provide an example frame
    > graph that does this?
    
    I've created the small attached example that demonstrates this for you. 
    It renders a torus shaped entity as a mask, followed by a simple cube as 
    the actual scene content. Left clicking on the cube toggles whether the 
    stencil buffers masks in or masks out the scene layer content. I've 
    briefly documented the MaskedForwardRenderer.qml frame graph for you.
    
    To control which entities are rendered in each phase of the frame, we 
    use a Layer and LayerFilter combination - don't forget to assign the 
    scene layer to your lights too.
    
    To improve the stencil writing pass, you could use a trivial shader 
    program that does the bare minimum of work rather than the phong 
    material I've used here for convenience.
    
    Hope this helps,
    
    Sean
    -- 
    Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
    KDAB (UK) Ltd, a KDAB Group company
    Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
    Mobile: +44 (0)7545 140604
    KDAB - Qt Experts
    


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170925/e03958be/attachment.html>


More information about the Interest mailing list