simvx.graphics.renderer.scene_renderer

Scene content rendering: opaque, transparent, and skinned geometry passes.

Module Contents

Classes

SceneContentRenderer

Handles rendering of 3D scene content: skybox, opaque, transparent, skinned, particles, debug.

Data

API

simvx.graphics.renderer.scene_renderer.__all__

[‘SceneContentRenderer’]

simvx.graphics.renderer.scene_renderer.log

‘getLogger(…)’

class simvx.graphics.renderer.scene_renderer.SceneContentRenderer(renderer: simvx.graphics.renderer.forward.Renderer)[source]

Handles rendering of 3D scene content: skybox, opaque, transparent, skinned, particles, debug.

Initialization

render_scene_content(cmd: Any, hdr_output: int = 0) None[source]

Render all 3D content: skybox, opaque geometry, skinned meshes, transparent geometry, particles, debug.

hdr_output is forwarded to the mesh push constant (1 = leave linear HDR for post-processing / offscreen targets, 0 = tone-map to the swapchain in the fragment shader). It is supplied per scene-render unit so a single primary command buffer can mix tonemapped and HDR targets without any shadow-SSBO read-modify-write.

two_phase_select(cmd: Any, viewports: Any, vis_prev: Any, vis_next: Any, vis_prev_mem: Any) None[source]

Two-phase PHASE 1: build the final batches + seed set A (GPU selection).

Runs in pre_render, OUTSIDE any render pass, BEFORE the camera proj is TAA-jittered. Builds each pass’s draw commands (the frustum-visible instances, first_instance == transform slot) into its dedicated occlusion indirect batch, then dispatches the phase-1 selection compute: it seeds the batch to set A only (instances visible last frame) and seeds vis_next = A. The depth prepass then draws the A-only batch; phase 2 patches in set-B survivors. PRIMARY viewport only.

render_depth_prepass(cmd: Any, depth_prepass: Any, view_proj_T: Any) None[source]

Draw set A (the phase-1-seeded final batches) depth-only into scratch depth.

Called from inside DepthPrepass.render’s render pass. Binds the depth-only pipeline + the shared SSBO set, pushes the camera VP, and issues the same per-mesh-group indirect draws _render_viewport would, but the instance_count has been seeded to set A only (B held at 0 -> drawn nothing).

two_phase_cull(cmd: Any, viewports: Any, vis_prev: Any, vis_next: Any, skip_cull: bool) None[source]

Two-phase PHASE 2: cull set B against the fresh Hi-Z; patch the final batch.

For each occlusion batch: barrier the depth prepass’s INDIRECT read against the compute write, then dispatch phase 2. Set A is kept unconditionally; set-B candidates run the conservative occlusion test (or all kept when skip_cull, i.e. the pyramid was just built this frame and is the first). vis_next is updated to the final drawn set.

read_occlusion_telemetry(*, wait: bool = False) int[source]

Sum instance_count over the culled occlusion indirect commands.

Reads the HOST_VISIBLE indirect memory directly (no TRANSFER copy) and stores the total on Renderer._last_drawn_instance_count. The cull dispatch must have COMPLETED on the GPU for the result to be meaningful; pass wait=True to vkDeviceWaitIdle first (test/telemetry use). The default (no wait) is for the start-of-prepass read of a prior frame.

property last_phase1_count: int[source]

Phase-1 (set A) command count of the most recent select (diagnostics).

render_velocity(cmd: Any, velocity_pass: Any) None[source]

Draw opaque + double-sided opaque instances into the velocity target.

Reuses the opaque cull/group/indirect path with the velocity pipeline, layout, and descriptor set (no texture set, no push constants: the velocity vertex shader reads cur/prev model SSBOs + a VP uniform). Skinned meshes, transparent geometry, particles and skybox are intentionally skipped here: per-object velocity covers opaque mesh instances only.

MultiMesh blocks are also drawn (one instanced run per block) so that moving MultiMesh nodes produce correct per-object motion vectors.