Package limn.render3d

Interface RenderPass


public interface RenderPass
The draw interface handed to a render callback (see Graphics3D.render(target, camera, body)). The target is already bound with depth testing on and the camera's view/projection set; issue clear(float, float, float, float) then draw(limn.render3d.GpuMesh, limn.render3d.Material, limn.math.Mat4) calls. Low-level and explicit: you place every mesh yourself.
  • Method Summary

    Modifier and Type
    Method
    Description
    addLight(Light light)
    Adds an analytic light for Material.Pbr (up to 8; extras are ignored).
    ambient(Vec3 color)
    Flat ambient/environment term for PBR (linear color; a stand-in for IBL).
    default RenderPass
    bloom(float threshold, float intensity, float radius)
    Adds a bright-pass glow to this pass's result, in linear light, before the display transform: pixels brighter than threshold spread by a blur of radius, and intensity of the result is added back into the target during the pass's own teardown.
    clear(float r, float g, float b, float a)
    Clears the color and depth of the target.
    default void
    debugLines(float[] vertices, int vertexCount, boolean depthTested)
    Submits immediate debug lines, usually via DebugDraw.flush(limn.render3d.RenderPass), not directly.
    void
    draw(GpuMesh mesh, Material material, Mat4 model)
    Draws mesh with material at the world transform model.
    default void
    drawShadowOnly(GpuMesh mesh, Mat4 model)
    Buffers mesh for the shadow depth pass only: a caster outside the camera frustum must still darken visible receivers, so retained scenes route their camera-culled meshes here when shadows are on.
    environment(Environment environment, IrradianceSh irradiance)
    Sets the image-based lighting environment for the PBR pass: diffuse from the baked irradiance (SH), specular from the environment's analytic sky, plus a skybox background.
    exposure(float exposure)
    Exposure multiplier for this pass's output (default 1).
    light(Vec3 direction, Vec3 color, float ambient)
    Sets the single directional light used by Material.SimpleLit (direction points toward the light; ambient in [0,1]).
    shadow(Vec3 direction, Vec3 center, float radius)
    Enables a directional shadow map for the PBR pass: the backend renders scene depth from direction (pointing toward the light) into an offscreen depth target fitted to a sphere of radius around center, and shadows the directional lights with PCF.
  • Method Details

    • clear

      RenderPass clear(float r, float g, float b, float a)
      Clears the color and depth of the target. The color is authored sRGB with straight alpha, like every other authored color; the backend decodes it to linear and premultiplies on write, per the target's color space.
    • light

      RenderPass light(Vec3 direction, Vec3 color, float ambient)
      Sets the single directional light used by Material.SimpleLit (direction points toward the light; ambient in [0,1]). Ignored by unlit and PBR materials.
    • addLight

      RenderPass addLight(Light light)
      Adds an analytic light for Material.Pbr (up to 8; extras are ignored). Independent of light(limn.math.Vec3, limn.math.Vec3, float): SimpleLit reads that one, PBR reads these. Colors are linear.
    • ambient

      RenderPass ambient(Vec3 color)
      Flat ambient/environment term for PBR (linear color; a stand-in for IBL).
    • exposure

      RenderPass exposure(float exposure)
      Exposure multiplier for this pass's output (default 1). Part of the display transform, not of the scene-referred pixels: it is recorded on the target and applied (before the tonemap) when the 2D composite draws it.
    • bloom

      default RenderPass bloom(float threshold, float intensity, float radius)
      Adds a bright-pass glow to this pass's result, in linear light, before the display transform: pixels brighter than threshold spread by a blur of radius, and intensity of the result is added back into the target during the pass's own teardown. Bloom is scene-side; exposure(float) is display-side. They compose in that order and do not interact.
      Parameters:
      threshold - linear scene-referred light above which a pixel contributes; 1 means "brighter than a fully-lit white surface", the useful floor
      intensity - how much of the blurred result is added; 0 (the default) disables bloom entirely: no allocation, no pass
      radius - the blur's standard deviation in points, the toolkit's logical unit (the backend converts to texels), so a glow keeps its size across display scales and viewport resizes. Below a small minimum the backend refuses to run rather than answer with a glow wider than asked; its half-res chain cannot blur narrower. Default: ignored (headless/test passes).
    • shadow

      RenderPass shadow(Vec3 direction, Vec3 center, float radius)
      Enables a directional shadow map for the PBR pass: the backend renders scene depth from direction (pointing toward the light) into an offscreen depth target fitted to a sphere of radius around center, and shadows the directional lights with PCF. Call once per pass; last wins.
    • environment

      RenderPass environment(Environment environment, IrradianceSh irradiance)
      Sets the image-based lighting environment for the PBR pass: diffuse from the baked irradiance (SH), specular from the environment's analytic sky, plus a skybox background. Pass null to disable (flat ambient is used).
    • draw

      void draw(GpuMesh mesh, Material material, Mat4 model)
      Draws mesh with material at the world transform model.
    • drawShadowOnly

      default void drawShadowOnly(GpuMesh mesh, Mat4 model)
      Buffers mesh for the shadow depth pass only: a caster outside the camera frustum must still darken visible receivers, so retained scenes route their camera-culled meshes here when shadows are on. No color-pass cost. Default: ignored (passes without shadow support).
    • debugLines

      default void debugLines(float[] vertices, int vertexCount, boolean depthTested)
      Submits immediate debug lines, usually via DebugDraw.flush(limn.render3d.RenderPass), not directly. vertices holds vertexCount world-space vertices interleaved as [x, y, z, r, g, b, a] (see DebugDraw.FLOATS_PER_VERTEX), two per line segment; the array is read before the pass's render call returns and may be longer than the used prefix. Debug lines never cast shadows. depthTested selects occlusion by scene geometry versus drawing on top ("X-ray"). Default: ignored (headless/test passes).