b3dLightShadowOrthoSize

Sets orthographic shadow map size for directional lights (controls shadow coverage area). Takes light (directional light handle), size (orthographic box half-size in world units). Returns nothing.

3D Graphics

Parameters & Returns

Parameters

light Int
size Double

Returns

Void

Quick Summary

Sets orthographic shadow map size for directional lights (controls shadow coverage area). Takes light (directional light handle), size (orthographic box half-size in world units). Returns nothing.

Technical Exegesis...

Sets orthographic shadow map size for directional lights (controls shadow coverage area). Takes light (directional light handle), size (orthographic box half-size in world units). Returns nothing. Stores size in light->shadowOrthoSize field. Only works with directional lights (type 1).

This function configures shadow coverage.

Example

Example.bam
; Create directional sun light with shadows
sunLight = b3dCreateLight(1)  ; Type 1 = directional
b3dRotateEntity(sunLight, 45.0, 135.0, 0.0)  ; Angle from above
b3dLightColor(sunLight, 255, 255, 240)
b3dLightIntensity(sunLight, 1.2)

; Configure shadow settings
b3dLightCastShadow(sunLight, True)  ; Enable shadows
b3dLightShadowOrthoSize(sunLight, 80.0)  ; 160x160 unit coverage
b3dLightShadowAlpha(sunLight, 0.6)  ; Semi-transparent shadows

; Indoor room lighting with tighter shadow area
roomLight = b3dCreateLight(1)
b3dRotateEntity(roomLight, 60.0, 180.0, 0.0)
b3dLightCastShadow(roomLight, True)
b3dLightShadowOrthoSize(roomLight, 15.0)  ; 30x30 unit room

; Dynamic shadow size based on camera zoom
; (Tighter shadows when zoomed in for better quality)
cameraDistance! = b3dEntityDistance(camera, player)
shadowSize! = mathMax(cameraDistance! * 0.5, 10.0)  ; Min 10 units
b3dLightShadowOrthoSize(sunLight, shadowSize!)