【问题标题】:How to make wireframe transparent in Qt3D?如何在 Qt3D 中使线框透明?
【发布时间】:2018-04-28 05:25:12
【问题描述】:

我试图在one of examples of Qt3D 中使线框透明,但失败了。 我在 robustwireframe.frag 中将 alpha 设置为 0.5,但它不起作用。

void main(){
// Calculate the color from the phong model
     vec4 color = vec4( adsModel( fs_in.position, normalize( fs_in.normal ) ), 0.5);
     fragColor = shadeLine( color );

如何在 Qt3D 中使线框透明?

【问题讨论】:

标签: qt qml qt5 qt3d


【解决方案1】:

BlendEquation 添加到renderStates 将启用Alpha 混合,因此将以下代码添加到WireframeEffect.qml 中的RenderPass:

RenderPass {
    renderStates: [
           BlendEquation {blendFunction: BlendEquation.Min}
     ]
     shaderProgram: ShaderProgram {
                        vertexShaderCode:loadSource("qrc:/shaders/robustwireframe.vert")
                        geometryShaderCode: loadSource("qrc:/shaders/robustwireframe.geom")
                        fragmentShaderCode: loadSource("qrc:/shaders/robustwireframe.frag")
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-14
    相关资源
    最近更新 更多