b3dCreateQuadRay

Creates volumetric god ray effect from an entity (light shafts through geometry). Takes entityHandle (source entity to copy for occlusion detection). Returns new entity handle (quad ray source entity, or 0 on error).

3D Graphics

Parameters & Returns

Parameters

entityHandle Int

Returns

Int

Quick Summary

Creates volumetric god ray effect from an entity (light shafts through geometry). Takes entityHandle (source entity to copy for occlusion detection). Returns new entity handle (quad ray source entity, or 0 on error).

Technical Exegesis...

Creates volumetric god ray effect from an entity (light shafts through geometry). Takes entityHandle (source entity to copy for occlusion detection). Returns new entity handle (quad ray source entity, or 0 on error). Copies source entity and marks as quad ray source for volumetric rendering.

This function creates god rays.

Example

Example.bam
; Create volumetric sunlight through windows
sunSphere = b3dCreateSphere(1, 0, 0, 16)  ; Simple sphere for occlusion
b3dPositionEntity(sunSphere, 100.0, 200.0, 50.0)  ; Position like sun
b3dScaleEntity(sunSphere, 20.0, 20.0, 20.0)  ; Large sphere
b3dEntityFX(sunSphere, BBR_FX_FULLBRIGHT%)  ; Make it bright

; Create god ray source from sun sphere
sunRays = b3dCreateQuadRay(sunSphere)

; Configure ray appearance
b3dSetQuadRayFade(sunRays, 20.0, 100.0)  ; Fade from 20 to 100 units
b3dSetQuadRayRadiance(sunRays, 0.5, 1.2)  ; Glow effect on screen
b3dSetQuadRayDirection(sunRays, 0.0, -1.0, -0.5)  ; Downward angled rays

; Create flashlight beam effect
flashlightCone = b3dCreateCone(1, 1, True, 16)
b3dPositionEntity(flashlightCone, 0.0, 1.0, 0.0)
b3dRotateEntity(flashlightCone, 90.0, 0.0, 0.0)  ; Point forward

flashlightRays = b3dCreateQuadRay(flashlightCone)
b3dSetQuadRayFade(flashlightRays, 0.5, 10.0)  ; Short range
b3dSetQuadRaySpread(flashlightRays, 2.0)  ; Wider beam
b3dSetParent(flashlightRays, camera, True)  ; Attach to camera

; Underwater light rays from surface
waterSurface = b3dCreatePlane(1)
b3dPositionEntity(waterSurface, 0.0, 10.0, 0.0)
b3dScaleEntity(waterSurface, 50.0, 1.0, 50.0)

underwaterRays = b3dCreateQuadRay(waterSurface)
b3dSetQuadRayDirection(underwaterRays, 0.0, -1.0, 0.0)  ; Downward
b3dSetEntityColorFX(underwaterRays, 100, 150, 255)  ; Blue tint