95 3D: Textured billboards
3D reference map · First 3D picture
billboard3d is the depth-tested spatial counterpart to a projected label. It is appropriate for a sprite, image annotation, or marker that must exist in the 3D viewport rather than above it. A billboard image is immutable straight-ARGB data, so it can be sampled by a render worker and uploaded by an OpenGL renderer without retaining a GUI bitmap% or a renderer-local texture in the Scene.
procedure
(billboard-image3d width height argb) → billboard-image3d?
width : exact-positive-integer? height : exact-positive-integer? argb : bytes?
procedure
(billboard-image3d? value) → boolean?
value : any/c
procedure
(billboard-style3d [ #:width width #:height height #:size-mode size-mode #:facing facing #:axis axis #:opacity opacity #:depth-mode depth-mode #:depth-bias depth-bias]) → billboard-style3d? width : positive? = 32 height : (or/c #f positive?) = #f size-mode : (or/c 'screen 'world) = 'screen facing : (or/c 'camera 'axis) = 'camera axis : vec3? = y-axis3 opacity : (real-in 0 1) = 1 depth-mode : (or/c 'test 'always 'hidden) = 'test depth-bias : nonnegative-real? = 1e-5
procedure
(billboard3d image position #:id id [ #:style style #:transform transform #:opacity opacity]) → spatial-visual? image : billboard-image3d? position : vec3? id : symbol? style : billboard-style3d? = (billboard-style3d) transform : transform3? = identity-transform3 opacity : (real-in 0 1) = 1
The software renderer and the explicit Racket/OpenGL renderer consume the same prepared corners, depth policy, and ARGB source. The executable probe is "examples/3d/textured-billboards.rkt".
Billboard limitations: source images use nearest sampling; a billboard whose world quad crosses the frustum boundary is conservatively omitted rather than clipped; partial alpha does not write depth; and billboards do not yet participate in exact spatial picking or cast/receive shadows. Use projected-label for source-mapped formulas and crisp vector text.