Enables or disables shadow casting for an entity.
Takes entity (entity handle from b3dLoadMesh/b3dCreateBox/etc), enable (1 = cast shadows, 0 = no shadows).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
entityInt
enableInt
Returns
Void
Quick Summary
Enables or disables shadow casting for an entity.
Takes entity (entity handle from b3dLoadMesh/b3dCreateBox/etc), enable (1 = cast shadows, 0 = no shadows).
Returns nothing.
Technical Exegesis...
Enables or disables shadow casting for an entity. Takes entity (entity handle from b3dLoadMesh, b3dCreateBox, or other entity creation function), enable (1 to enable shadow casting, 0 to disable shadow casting). Returns nothing. Controls whether entity casts shadows onto other objects when lit by shadow-casting lights. Affects DirectX 12 shadow map rendering.
Enables or disables shadow casting for an entity. Takes entity (entity handle from b3dLoadMesh, b3dCreateBox, or other entity creation function), enable (1 to enable shadow casting, 0 to disable shadow casting). Returns nothing. Controls whether entity casts shadows onto other objects when lit by shadow-casting lights. Affects DirectX 12 shadow map rendering.
Shadow casting: enabled entities render into shadow maps (depth buffer captures entity geometry, shadow map used to test if other surfaces in shadow), disabled entities invisible to shadow rendering (don't occlude light, don't cast shadows on other objects, but can still receive shadows if enabled). Default typically enabled for most entities.
Use cases: (1) Performance optimization (disable shadows on small/distant objects to reduce shadow map draw calls), (2) Transparent objects (disable shadow casting for glass/particles that shouldn't cast shadows), (3) Skybox (disable shadows on sky dome), (4) Decorative objects (disable shadows on non-gameplay objects). Common patterns: enable shadows on important geometry (characters, vehicles, buildings), disable on particles/effects/skybox.
Shadow receiving: separate from shadow casting (entity can receive shadows without casting them, controlled by material settings or separate function), shadow casting affects what shadows this entity creates on others. Shadow quality: depends on light shadow settings (b3dLightShadowNearFar, b3dLightShadowMaxDistance, etc control shadow map resolution and range).
Performance: disabled shadow casting reduces shadow map rendering cost (fewer draw calls, smaller shadow map data), useful for LOD systems (disable shadows on distant objects), typical optimization (enable shadows on 20-30 important objects, disable on hundreds of decorative objects). Validation: silently returns if entity invalid, no validation on enable value (non-zero treated as true, zero as false).
Related: b3dLoadMesh/b3dCreateBox/etc create entities (shadow casting configurable per entity), b3dCreateLight creates lights (must enable shadow casting on light for shadows to render), b3dLightShadowNearFar/b3dLightShadowMaxDistance configure light shadow quality.
Example
Example.bam
; Enable shadow casting on main character
player = b3dLoadMesh("character.glb", 1, 0)
b3dEntityCastShadow(player, 1)
; Disable shadow casting on skybox
sky = b3dLoadMesh("skybox.glb", 1, 0)
b3dEntityCastShadow(sky, 0)
; Disable shadows on particle effectsFor i = 0To99
particle = b3dCreateBox()
b3dEntityCastShadow(particle, 0)
Next