; Requires Extended language mode. ; A full-screen bright-pass bloom effect with a one-key before/after view. Include "_common\ShowcaseCamera.bb" Graphics3D 960,600,0,2 camera=CreateCamera():PositionEntity camera,0,0,-8 CameraClsColor camera,3,5,14 pivot=CreatePivot() floor=CreateCube():ScaleEntity floor,7,.06,7:PositionEntity floor,0,-2.35,3:EntityColor floor,20,26,42 For index=0 To 8 angle#=index*40 orb=CreateSphere(24,pivot) PositionEntity orb,Cos(angle)*2.7,Sin(angle)*2.0,0 Select index Mod 3 Case 0:EntityColor orb,255,45,20 Case 1:EntityColor orb,40,120,255 Case 2:EntityColor orb,80,255,90 End Select EntityFX orb,1 Next core=CreateSphere(32,pivot):ScaleEntity core,1.15,1.15,1.15 EntityColor core,255,245,190:EntityFX core,1 effect=LoadShader("builtin:bloom") If effect=0 Then RuntimeError "Could not load builtin:bloom" threshold#=.55 intensity#=1.7 radius#=3.5 CameraEffect camera,effect lastTime=MilliSecs() paused=False:ResetShowcaseCameraTimer() While Not KeyHit(1) now=MilliSecs() elapsed#=(now-lastTime)/1000.0 lastTime=now UpdateShowcaseCamera camera,4,70 If KeyHit(25) Then paused=Not paused If KeyDown(26) Then threshold=threshold-elapsed*.35 If KeyDown(27) Then threshold=threshold+elapsed*.35 If KeyDown(12) Then intensity=intensity-elapsed*.9 If KeyDown(13) Then intensity=intensity+elapsed*.9 If KeyDown(44) Then radius=radius-elapsed*4.0 If KeyDown(45) Then radius=radius+elapsed*4.0 If threshold<0 Then threshold=0 If threshold>.95 Then threshold=.95 If intensity<0 Then intensity=0 If intensity>3 Then intensity=3 If radius<.5 Then radius=.5 If radius>8 Then radius=8 ShaderFloat effect,"Threshold",threshold ShaderFloat effect,"Intensity",intensity ShaderFloat effect,"Radius",radius CameraEffectEnabled camera,effect,Not KeyDown(57) If Not paused Then TurnEntity pivot,0,0,.25 RenderWorld Color 255,255,255 Text 12,12,"Full-screen bloom - hold SPACE to bypass" Text 12,32,"[ / ] Threshold: "+Int(threshold*100)+"%" Text 12,48,"- / = Intensity: "+Int(intensity*100)+"%" Text 12,64,"Z / X Radius: "+Int(radius*10)/10.0+" pixels" Text 12,80,"P pauses the orbit so the bloom footprint can be inspected" DrawShowcaseCameraHelp 570 Flip Wend FreeShader effect:End