Returns entity alpha transparency value (0.0-1.0 double).
Takes entity (mesh entity handle, positive integer).
Returns double alpha (0.0=fully transparent to 1.0=fully opaque, -1.0 on error).
3D Graphics
Parameters & Returns
Parameters
entityInt
Returns
Double
Quick Summary
Returns entity alpha transparency value (0.0-1.0 double).
Takes entity (mesh entity handle, positive integer).
Returns double alpha (0.0=fully transparent to 1.0=fully opaque, -1.0 on error).
Technical Exegesis...
Returns entity alpha transparency value (0.0-1.0 double). Takes entity (mesh entity handle, positive integer). Returns double alpha (0.0=fully transparent to 1.0=fully opaque, -1.0 on error). Queries current alpha/transparency from entity material, checks material override first then base material.
Alpha value meaning: 0.0=fully transparent (invisible), 0.5=half transparent (50% visibility), 1.0=fully opaque (solid, default), values clamped to 0.0-1.0 range.
Material source: checks entity.
Returns entity alpha transparency value (0.0-1.0 double). Takes entity (mesh entity handle, positive integer). Returns double alpha (0.0=fully transparent to 1.0=fully opaque, -1.0 on error). Queries current alpha/transparency from entity material, checks material override first then base material.
Alpha value meaning: 0.0=fully transparent (invisible), 0.5=half transparent (50% visibility), 1.0=fully opaque (solid, default), values clamped to 0.0-1.0 range.
Material source: checks entity.materialOverrideIndex first (if >= 0 uses per-entity override material), falls back to entity.mesh->materialIndex (shared mesh material), reads material.baseColorFactor.w (RGBA alpha channel).
Use cases: (1) Query current transparency (read alpha for UI display or logic), (2) Alpha restoration (save alpha before modification: oldAlpha=b3dGetEntityAlphaFX(e): b3dSetEntityAlphaFX(e, 0.5): later b3dSetEntityAlphaFX(e, oldAlpha)), (3) Conditional logic (If b3dGetEntityAlphaFX(entity)<0.5 Then entity is transparent), (4) Fade transitions (interpolate between current and target alpha), (5) Visibility checks (determine if entity visible or faded out).
Common patterns: save alpha = oldAlpha#=b3dGetEntityAlphaFX(entity%); check visibility = If b3dGetEntityAlphaFX(entity%)>0.0 Then visible; fade interpolation = currentAlpha#=b3dGetEntityAlphaFX(entity%): newAlpha#=currentAlpha#+(targetAlpha#-currentAlpha#)*fadeSpeed#: b3dSetEntityAlphaFX(entity%, newAlpha#).
Return values: -1.0 on error (invalid entity handle, non-mesh entity, prints error to stderr), 1.0 if mesh has no material (opaque white default), 0.0-1.0 actual alpha value (from material.baseColorFactor.w).
Performance: very fast O(1) lookup (simple material field access, ~0.0001ms), no calculation or GPU access required, suitable for per-frame queries.
Material override awareness: reads from correct material layer (override if exists, else base material), consistent with b3dSetEntityAlphaFX behavior (set and get use same material source).
PBR material: alpha stored in baseColorFactor.w (RGBA format: x=red, y=green, z=blue, w=alpha), affects material transparency rendering.
Related: b3dSetEntityAlphaFX sets entity alpha transparency, b3dEntityBlend sets blend mode (must be 1 for alpha to work), b3dGetEntityRedFX/GreenFX/BlueFX read RGB color components, b3dSetEntityColorFX sets RGB color.