Sets shadow camera near and far planes for a light.
Takes light (light handle from b3dCreateLight), nearPlane (shadow camera near clip distance in units), farPlane (shadow camera far clip distance in units).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
lightInt
nearPlaneDouble
farPlaneDouble
Returns
Void
Quick Summary
Sets shadow camera near and far planes for a light.
Takes light (light handle from b3dCreateLight), nearPlane (shadow camera near clip distance in units), farPlane (shadow camera far clip distance in units).
Returns nothing.
Technical Exegesis...
Sets shadow camera near and far planes for a light's shadow rendering. Takes light (light handle from b3dCreateLight with shadow casting enabled), nearPlane (shadow camera near clip plane distance in units, objects closer than this don't cast shadows, typical 0.1-1.0), farPlane (shadow camera far clip plane distance in units, objects farther than this don't cast shadows, typical 50-500). Returns nothing. Configures shadow map depth range in DirectX 12 rendering system.
Sets shadow camera near and far planes for a light's shadow rendering. Takes light (light handle from b3dCreateLight with shadow casting enabled), nearPlane (shadow camera near clip plane distance in units, objects closer than this don't cast shadows, typical 0.1-1.0), farPlane (shadow camera far clip plane distance in units, objects farther than this don't cast shadows, typical 50-500). Returns nothing. Configures shadow map depth range in DirectX 12 rendering system.
Near/far planes: define shadow map depth range (nearPlane = closest distance that casts shadows, farPlane = farthest distance that casts shadows, objects outside range don't appear in shadow map), affect shadow precision (smaller range = better depth precision = less shadow acne, larger range = covers more area but lower precision). Shadow camera: directional light uses orthographic projection (parallel rays, near/far define depth range), point/spot lights use perspective projection (radial rays, near/far define radial depth).
Shadow precision: depth precision = (farPlane - nearPlane) / shadow map resolution (tighter range = better precision per pixel, wider range = worse precision, can cause shadow acne/peter-panning). Typical values: close-up shadows (nearPlane 0.1, farPlane 50 for tight precision), medium range (nearPlane 1, farPlane 100 for balanced), long range (nearPlane 5, farPlane 500 for large outdoor scenes).
Use cases: (1) Directional sun light (nearPlane 1, farPlane 200 for outdoor scene), (2) Indoor spot light (nearPlane 0.1, farPlane 20 for small room), (3) Point light (nearPlane 0.5, farPlane 50 for medium area), (4) Long-distance shadows (nearPlane 10, farPlane 1000 for vast landscape, requires cascaded shadows). Common patterns: tight near plane (0.1-1 to avoid shadow on light itself), far plane matching scene bounds (don't extend farther than needed for performance).
Shadow artifacts: near plane too small causes shadows near light source (self-shadowing artifacts), far plane too large causes depth precision loss (shadow acne, z-fighting), adjust near/far to minimize artifacts while covering necessary range. Performance: near/far range doesn't directly affect performance (shadow map resolution same regardless), but affects quality (tighter range = better precision = fewer artifacts = can use lower resolution for same quality).
Cascaded shadows: directional lights may use multiple shadow cascades (each cascade has different near/far for different distance ranges, not directly controlled by this function, engine may automatically split range into cascades). Validation: silently returns if light invalid, no validation on nearPlane/farPlane values (negative or swapped values may cause unexpected results, ensure nearPlane < farPlane).
Related: b3dCreateLight creates light (enable shadows with shadow parameter), b3dLightShadowMaxDistance sets maximum shadow distance (alternative to farPlane for different effect), b3dLightShadowCameraDistance offsets shadow camera position, b3dEntityCastShadow controls which entities cast shadows.
Example
Example.bam
; Outdoor sun light with medium-range shadows
sun = b3dCreateLight(1) ; Directional light
b3dLightShadowNearFar(sun, 1.0, 150.0)
; Indoor spot light with tight precision
spotlight = b3dCreateLight(2) ; Spot light
b3dLightShadowNearFar(spotlight, 0.1, 25.0)
; Point light for medium area
pointLight = b3dCreateLight(3)
b3dLightShadowNearFar(pointLight, 0.5, 50.0)