Qt3D: Do I need to re-enable the state ( ColorMask for example) in next RenderPass?



  • I need multiple pass rendering,
    In first pass I set the stencil buffer, the second I draw color buffer with stencil test.

    renderPasses: [
                    RenderPass {
                        shaderProgram: clipShader
                        renderStates: [
                            ClipPlane { planeIndex: 0 },
                            ColorMask {
                                alphaMasked: false
                                redMasked: false
                                blueMasked: false
                                greenMasked: false
                            },
                            CullFace {
                                mode: CullFace.NoCulling
                            },
    
                            StencilTest {
                                back.stencilFunction:StencilTestArguments.Always
                                back.referenceValue: 0
                                back.comparisonMask: 0xff
                                front.stencilFunction: StencilTestArguments.Always
                                front.referenceValue: 0
                                front.comparisonMask: 0xff
                            },
                            StencilOperation {
                                back.allTestsPassOperation: StencilOperationArguments.DecrementWrap
                                back.stencilTestFailureOperation: StencilOperationArguments.Keep
                                back.depthTestFailureOperation: StencilOperationArguments.Keep
                                front.allTestsPassOperation: StencilOperationArguments.IncrementWrap
                                front.stencilTestFailureOperation: StencilOperationArguments.Keep
                                front.depthTestFailureOperation: StencilOperationArguments.Keep
                            }
                        ]
                    },
                    RenderPass {
                        shaderProgram: clipShader
                        renderStates: [
                            ClipPlane { planeIndex: 0 },
                            // If I comment out ColorMask, nothing is drawn
                            ColorMask {},
                            CullFace {
                                mode: CullFace.Front
                            },
    
                            StencilTest {
                                back.stencilFunction:StencilTestArguments.Equal
                                back.referenceValue: 1
                                back.comparisonMask: 0xff
                                front.stencilFunction: StencilTestArguments.Equal
                                front.referenceValue: 1
                                front.comparisonMask: 0xff
                            },
                            StencilOperation {
                                back.allTestsPassOperation: StencilOperationArguments.Keep
                                back.stencilTestFailureOperation: StencilOperationArguments.Keep
                                back.depthTestFailureOperation: StencilOperationArguments.Keep
                                front.allTestsPassOperation: StencilOperationArguments.Keep
                                front.stencilTestFailureOperation: StencilOperationArguments.Keep
                                front.depthTestFailureOperation: StencilOperationArguments.Keep
                            }
    
                        ]
                    }
    

    In the second RenderPass I must specify a ColorMask, or else nothing will be drawn.

    So during the render passes, the all the RenderStates are all kept along ?

    ( Shouldn't each render pass have its own render state? )


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.