Compare commits

...

3 Commits

Author SHA1 Message Date
Nyall Dawson
faf1b86967
Merge 389e8f82179eac822c7295a9f1d7dd74928583a1 into d63653925c5c55cf16618e5ed16fb71f0c9620dc 2025-10-01 12:49:48 +10:00
Nyall Dawson
389e8f8217
Test mask update 2025-10-01 12:49:39 +10:00
Nyall Dawson
01ae564e4e
[3d] Improve quality of billboard rendering
Add transparency layer to QgsPoint3DBillboardMaterial entities,
so that they get rendered in the transparent pipeline instead
of the opaque pipeline. Adjust alpha discard threshold in billboard
fragment shader to permit semi-opaque pixel rendering.

Pros: nicely smoothed billboard symbol rendering, without harsh
aliased edges. Billboard symbols can use semi-transparent colors.

Cons: Introduces ordering issues for billboards, where billboards
which should be shown behind others will appear in front from
some angles (i.e. the same issue as we get for 3d polygon objects
with transparency)
2025-10-01 09:27:58 +10:00
5 changed files with 9 additions and 2 deletions

View File

@ -878,6 +878,14 @@ void Qgs3DMapScene::finalizeNewEntity( Qt3DCore::QEntity *newEntity )
} }
} }
} }
else if ( QgsPoint3DBillboardMaterial *billboardMaterial = qobject_cast<QgsPoint3DBillboardMaterial *>( material ) )
{
Qt3DCore::QEntity *entity = qobject_cast<Qt3DCore::QEntity *>( billboardMaterial->parent() );
if ( entity && !entity->components().contains( transparentLayer ) )
{
entity->addComponent( transparentLayer );
}
}
else else
{ {
// This handles the phong material with data defined properties, the textured case and point (instanced) symbols. // This handles the phong material with data defined properties, the textured case and point (instanced) symbols.

View File

@ -7,9 +7,8 @@ out vec4 fragColor;
void main(void) void main(void)
{ {
fragColor = texture(tex0, vec2(UV.x, 1.0f - UV.y)); fragColor = texture(tex0, vec2(UV.x, 1.0f - UV.y));
if (fragColor.a < 0.5) if (fragColor.a < 0.01)
discard; discard;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB