You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #74. Roadmap Phase 2 item (see #57). OptiX 9.1 cluster acceleration is supported (see rtx.py cluster accel APIs) and has been validated on A6000. Cluster GAS provides superior BVH quality and ray traversal performance but is more expensive to build. Currently, GAS type is chosen uniformly — either everything is cluster or everything is standard. A hybrid approach uses cluster GAS where it matters (nearby, high-detail geometry) and standard GAS where build cost matters more than traversal quality (distant, simplified geometry).
Goal
Automatically select cluster vs. standard GAS per geometry based on distance from camera, so nearby geometry gets optimal traversal while distant geometry avoids expensive cluster builds.
Current State
Cluster GAS support is fully operational: PipelineCompileOptions.allowClusteredGeometry = 1, CLAS partitioning, 4-param optixGetTriangleVertexData() (see MEMORY.md)
Terrain LOD tiles (terrain_lod_r{R}_c{C}) rebuild at varying resolutions — all currently use the same GAS build path
Cluster terrain partitioning uses BLOCK = min(isqrt(maxVerts)-1, isqrt(maxTris/2)), typically 11 for max 256/256
_detect_capabilities() in rtx.py queries device cluster support at startup
Design
Distance-Based GAS Type Selection
Zone
Distance
GAS type
Rationale
Near
< threshold₁
Cluster GAS
Best traversal quality for detailed close-up geometry
Far
≥ threshold₁
Standard GAS
Faster build, adequate traversal for simplified meshes
Threshold aligned with terrain LOD tile grid — entire tiles switch type, not individual triangles
Default threshold: tile_diagonal * lod_distance_factor (same first LOD transition distance)
Both GAS types coexist in the same IAS via per-instance transforms
Integration with Terrain LOD
TerrainLODManager.update() already decides LOD level per tile — extend to also decide GAS type
LOD 0 tiles → cluster GAS (highest detail, worth the build cost)
LOD 1+ tiles → standard GAS (reduced triangle count, fast build)
Billboard imposters always standard (trivial geometry, 2 triangles)
Rebuild Strategy
Cluster GAS is expensive — only rebuild when camera moves significantly (> 1 tile width)
When a tile transitions from standard → cluster, build cluster GAS; cache both versions
When transitioning cluster → standard, the standard version is already cached or cheap to build
_rebuild_at_resolution() invalidates both cluster and standard caches (terrain data changed)
Capability Fallback
If device doesn't support clusters (_detect_capabilities() returns clusters=False), all GAS are standard — no hybrid logic needed
allowClusteredGeometry pipeline option only set when at least one cluster GAS exists
Implementation Plan
GAS type selection in TerrainLODManager — extend update() to tag tiles with gas_type='cluster'|'standard' based on LOD level
Dual-path GAS build in rtx.py — add_geometry() accepts optional gas_type parameter, routes to cluster or standard build
Cache key extension — add gas_type to tile cache and chunk manager cache keys
IAS mixed construction — verify cluster and standard GAS instances coexist correctly in a single IAS (they should — both are valid traversable handles)
Threshold configuration — expose cluster_distance_factor on TerrainLODManager and viewer settings
Capability gate — skip cluster path entirely on non-cluster-capable devices
HUD stats — show cluster/standard tile counts in LOD stats line
Watch Out For
allowClusteredGeometry = 1 must be set in pipeline compile options whenever any cluster GAS is present — forgetting this causes validation errors / illegal memory access
4-param optixGetTriangleVertexData(gas, primIdx, sbtIdx, time, data) works on both cluster and standard GAS — no shader changes needed
Cluster build memory can be significant for high-detail tiles; monitor GPU memory pressure
Context
Follow-up to #74. Roadmap Phase 2 item (see #57). OptiX 9.1 cluster acceleration is supported (see
rtx.pycluster accel APIs) and has been validated on A6000. Cluster GAS provides superior BVH quality and ray traversal performance but is more expensive to build. Currently, GAS type is chosen uniformly — either everything is cluster or everything is standard. A hybrid approach uses cluster GAS where it matters (nearby, high-detail geometry) and standard GAS where build cost matters more than traversal quality (distant, simplified geometry).Goal
Automatically select cluster vs. standard GAS per geometry based on distance from camera, so nearby geometry gets optimal traversal while distant geometry avoids expensive cluster builds.
Current State
PipelineCompileOptions.allowClusteredGeometry = 1, CLAS partitioning, 4-paramoptixGetTriangleVertexData()(see MEMORY.md)terrain_lod_r{R}_c{C}) rebuild at varying resolutions — all currently use the same GAS build path_detect_capabilities()inrtx.pyqueries device cluster support at startupDesign
Distance-Based GAS Type Selection
tile_diagonal * lod_distance_factor(same first LOD transition distance)Integration with Terrain LOD
TerrainLODManager.update()already decides LOD level per tile — extend to also decide GAS type(tr, tc, lod, base_sub, gas_type)Integration with Instanced Geometry LOD (#80)
Rebuild Strategy
_rebuild_at_resolution()invalidates both cluster and standard caches (terrain data changed)Capability Fallback
_detect_capabilities()returnsclusters=False), all GAS are standard — no hybrid logic neededallowClusteredGeometrypipeline option only set when at least one cluster GAS existsImplementation Plan
update()to tag tiles withgas_type='cluster'|'standard'based on LOD leveladd_geometry()accepts optionalgas_typeparameter, routes to cluster or standard buildgas_typeto tile cache and chunk manager cache keyscluster_distance_factoronTerrainLODManagerand viewer settingsWatch Out For
allowClusteredGeometry = 1must be set in pipeline compile options whenever any cluster GAS is present — forgetting this causes validation errors / illegal memory accessoptixGetTriangleVertexData(gas, primIdx, sbtIdx, time, data)works on both cluster and standard GAS — no shader changes neededKey Files
rtxpy/rtx.py— cluster accel APIs,add_geometry(),_detect_capabilities()rtxpy/viewer/terrain_lod.py—TerrainLODManager.update(),_build_tile_mesh()rtxpy/engine.py—_MeshChunkManager,_rebuild_at_resolution()rtxpy/lod.py—compute_lod_level(),compute_lod_distances()References