Applies screen shader for this frame (sets active shader, full-screen post-processing applied after 3D rendering).
Takes shader (shader handle from b3dLoadScreenShader, positive integer, or 0 for default).
Returns nothing.
Shaders
Parameters & Returns
Parameters
shaderInt
Returns
Void
Quick Summary
Applies screen shader for this frame (sets active shader, full-screen post-processing applied after 3D rendering).
Takes shader (shader handle from b3dLoadScreenShader, positive integer, or 0 for default).
Returns nothing.
Technical Exegesis...
Applies screen shader for this frame (sets active shader, full-screen post-processing applied after 3D rendering). Takes shader (shader handle from b3dLoadScreenShader, positive integer, or 0 for default). Returns nothing. Sets g_activeScreenShader3D = shader (marks shader as active for current frame, engine applies during post-processing).
Applies screen shader for this frame (sets active shader, full-screen post-processing applied after 3D rendering). Takes shader (shader handle from b3dLoadScreenShader, positive integer, or 0 for default). Returns nothing. Sets g_activeScreenShader3D = shader (marks shader as active for current frame, engine applies during post-processing). Use to activate custom post-processing effect (CRT, blur, color grading, distortion), switch between effects dynamically (change shader per frame based on game state), or apply shader conditionally (enable effect when condition met, clear otherwise). Apply behavior: sets active shader (g_activeScreenShader3D stores handle, used by rendering pipeline), immediate next frame (shader applies starting next b3dRenderWorld call), persists until changed (remains active each frame until ClearScreenShader or different ApplyScreenShader called), shader 0 clears (passing 0 same as b3dClearScreenShader, reverts to default). Use cases: (1) Activate effect (b3dApplyScreenShader(crtShader) apply CRT scanlines), (2) Switch effects (If underwater Then b3dApplyScreenShader(underwaterShader) Else b3dApplyScreenShader(normalShader)), (3) Conditional effect (If damageFlash Then b3dApplyScreenShader(redFlashShader) apply on damage), (4) Disable effect (b3dApplyScreenShader(0) clear and revert to default), (5) Dynamic transitions (lerp between shaders by switching each frame, fade effects). Common patterns: activate = b3dApplyScreenShader(shader) apply effect; clear = b3dApplyScreenShader(0) revert to default; conditional = If condition Then b3dApplyScreenShader(effectShader). Typical workflow: load shader (shader = b3dLoadScreenShader("effect.hlsl")), configure parameters (b3dSetShaderFloat/Int set uniforms), apply shader (this function, activates for frame), render (b3dRenderWorld applies shader as post-processing), repeat or clear (apply each frame for persistence, or clear when done). Rendering pipeline: 3D scene rendered to texture (main render target, all meshes/lights/effects), shader applied to texture (full-screen quad with custom pixel shader, reads scene texture), output to back buffer (final composited frame, displayed on screen), post-processing pass (shader runs once per frame, processes entire screen). Shader persistence: active until changed (shader applies every frame automatically, engine uses g_activeScreenShader3D), call once to enable (don't need to call every frame, persists across frames), call again to switch (change active shader, instant switch next frame), call with 0 to disable (reverts to default rendering, no shader). Multiple shaders: only one active (g_activeScreenShader3D single value, one shader at a time), switch between shaders (call ApplyScreenShader with different handle, instant switch), shader chain NOT SUPPORTED (can't apply multiple shaders in sequence, only one post-processing pass), workaround = combine effects (single shader with multiple techniques, or offline shader merging). Shader parameters: configure before or after apply (b3dSetShaderFloat/Int/Float2/etc set uniforms, independent of apply timing), parameters persist (stored in shader.parameters map, remain until changed), apply reads parameters (engine passes parameters to shader via constant buffer during render). Performance: apply cost zero (flag set, trivial operation), shader cost depends on complexity (per-pixel operation, simple shaders ~0.1ms, complex shaders ~1-5ms), full-screen processing (every pixel processed, 1920x1080 = 2M pixels x shader cost per pixel). Validation: accepts any shader value (positive for valid shader, 0 for default, negative treated as invalid but no error), doesn't check shader exists (assumes valid handle, using invalid handle may crash or display nothing), safe to call with 0 (always safe, clears active shader). No return value: void function (doesn't indicate success/failure), assumes success (shader active if valid, nothing if invalid), silent operation (no error messages, no confirmation prints). Related: b3dLoadScreenShader loads shader (creates shader applied by this function), b3dFreeScreenShader frees shader (should not apply after freeing), b3dClearScreenShader clears active (alternative to applying 0, reverts to default), b3dSetDefaultScreenShader same as clear (reverts to default), b3dSetShaderFloat sets parameter (configures shader uniform, used before/after apply).