mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-24 00:47:57 -05:00
Qt3DRender::QTexture2D does not handle opacity. Therefore, it is not possible to use the default Qt3DExtras::QDiffuseSpecularMaterial implementation. This problem is solved by using Qt3DRender::QMaterial and copying the Qt3DExtras::QDiffuseSpecularMaterial shaders from Qt3D source code. Then, the texture color needs to be changed to set the correct opacity. This is achieved in the fragement shader: ``` vec4 diffuseTextureColor = vec4(texture(diffuseTexture, texCoord).rgb, opacity); ``` instead of the default: ``` vec4 diffuseTextureColor = vec4(texture(diffuseTexture, texCoord)); ``` As far as the FrameGraph is concerned, this is already handled in Qgs3DMapScene::finalizeNewEntity which checks for all material which have an effect with an opacity parameter.