Performance and compatibility
Optimization
Tune density, distance, chunking, culling, memory, and runtime quality.
Measure the Player
Use a Development Player at a fixed resolution, camera, quality level, density, lighting mode, and graphics API. Warm the renderer before sampling. Report CPU frame time, GPU frame time, grass-stage CPU markers, visible blades, visible chunks, indirect commands, GPU memory, and steady-state managed allocation separately.
Editor Game-view FPS is useful for interaction checks but is not a release benchmark. Record controlled Development Player results for the target hardware and keep internal evidence separate from the distributable package.
Choose a submission backend
Indirect is the production submission path. BatchRendererGroup remains in the public enum and serialized renderer data for compatibility, but production does not adopt it: a stored or scripted request uses Indirect, and Last camera reports why. BRG’s native rendering path remains unqualified for customer use.
Selecting the retained request does not change grass data, settings, density or require a rebake. It does not require BRG shader variants in a production Player because the renderer keeps using Indirect. The Inspector’s last-camera status shows the actual path.
Scripts can continue reading and writing renderer.SubmissionBackend to preserve existing scene and integration data. A production BatchRendererGroup request stays serialized but uses Indirect; read renderer.SubmissionBackendStatus after a camera has rendered to confirm the fallback.
Choose resident GPU visibility
CPU visibility is the production path. ResidentGpu remains in the public enum and serialized renderer data for compatibility, but production does not adopt it: a stored or scripted request uses complete CPU visibility, and Visibility status reports why. No selection or rebake is needed.
The Resident GPU rendering path and its associated Hi-Z suppression remain unqualified for production use. Current Frame therefore fails open to CPU visibility and does not suppress grass. Existing renderer settings and public enum values are retained; check Visibility status to see the actual path.
Capture GPU counts remains a diagnostic setting and does not enable the production Resident GPU route. Production rendering does not allocate Resident GPU visibility resources for this request.
Select the quality budget
| target | package profile | runtime level | intended use |
|---|---|---|---|
| cinematic desktop | Cinematic | High | hero shots and the 60 FPS reference scene |
| balanced desktop | Desktop High | Medium | the replacement for the old planned Desktop Balanced preset |
| high mobile | Mobile High | High | compute-capable mobile targets after device validation |
| low mobile | Mobile Low | Low | reduced distance, survivors, and cameras |
| disabled | any | Off | no culling, upload, stomp, or draw work |
High, Medium, and Low reuse the same packed 24-byte blade allocation. Normal Off retains it for instant reactivation. Release Resources While Off is a separate delayed memory policy and can add a reload or regeneration cost later.
Tune the real bottleneck
- If GPU time rises with stable CPU time, reduce survivor density, maximum distance, shadows, procedural motion vectors, semantic field resolution, or overdraw-heavy far width.
- If CPU grass stages rise with species count, inspect visible commands. Species share one blade budget but require material and geometry command ranges.
- If memory is high, lower the total blade cap or author a smaller field. Do not create one blade allocation per runtime quality level.
- If dirty painting stalls, increase chunk size only after measuring the tradeoff between command count and patch granularity.
- Automatic GPU occlusion currently retains conservative visibility. Forced Hi-Z collects diagnostic probes on supported game cameras; it does not suppress grass. Camera-only asynchronous history cannot guarantee visibility after an occluder moves, and total depth-production and rendering savings require qualification before adoption. The renderer status panel reports this fallback.
The Profiler exposes initialization, pending updates, regeneration, dirty updates, interaction, bake loading, disable, destroy, resource release and Hi-Z readback processing alongside camera preparation, culling, uploads and submission. Rendering statistics separate visible blades, main/shadow argument instances and indices, useful main argument instances and settled LOD3 padding. Argument counts describe submitted work; they do not measure pixels shaded or isolated GPU cost.
Current-frame depth occlusion
Current-frame depth occlusion is not adopted for production because it requires Resident GPU visibility. A CurrentFrame setting or a configured Current-Frame Hi-Z Renderer Feature remains conservative while production Resident GPU is disabled; original CPU-visible grass remains visible.
The renderer feature and measured-admission controls remain available for internal qualification only. They do not change production fallback behavior or imply customer support for Resident GPU or current-frame suppression. Automatic and diagnostic HiZ retain conservative visibility.
Choose visibility optimizations
In Performance > Visibility optimizations, start with Stable command order and all three options off. These controls belong to each renderer, including a renderer using shared grass and quality profiles. Switching them does not change blade data, density, quality budgets or require a rebake. Compare the complete Player path and native grass, receiver shadows and motion before selecting a policy for a scene.
Spatial groups compatible settled commands by locality. Front To Back sorts within compatible main or shadow groups; Spatial Then Front To Back applies both. Construction and sorting add CPU work and can change padded submitted work. Preserve Stable unless downstream rendering offsets that cost. Selecting an ordering unsupported by Resident GPU visibility keeps complete CPU visibility; Visibility status explains the choice.
Use Local Deformation Bounds tightens conservative chunk visibility using authoritative single-species blade height and wind/interaction limits. Submission envelopes retain their original padding and sorting centers. Multiple species, invalid inputs or large-coordinate uncertainty retain conservative padding. Wind, artist multipliers, LOD and interaction changes are evaluated on the current render.
Reuse Stationary Visibility compares every scalar, camera identity, resource identity and relevant native input byte before copying a completed result. Camera movement or switching, geometry recreation, bounds, terrain heights, holes, origin and settings changes immediately evaluate current visibility. A snapshot is captured only after consecutive stable inputs and reserves at most8MiB. Comparing and copying can cost more than culling, particularly for large heightmaps and multiple species. The Inspector reports actual reuse, verified input bytes and snapshot payload. Turning the option off releases its snapshot.
Use Local Terrain Holes allows conservative terrain occlusion only along corridors proven free of holes. It validates actual hole content before use, including writes made before an authoring callback. A hole crossing a corridor, an unavailable map or a map above1million cells retains visible grass. High-resolution content validation adds CPU work; compare its cost with the rendering work actually avoided. Turning the option off releases its snapshot.
Scripts can call renderer.RenderSettings.SetCommandOrdering(...) and SetVisibilityOptimizations(localDeformationBounds, stationaryVisibility, localTerrainHoles). Settings changes invalidate the renderer's resolved inputs without needing Inspector callbacks. These storage limits do not guarantee a frame budget or a gain for every workload.
Detailed rendering timings
Detailed stage measurements are off by default. In the renderer Inspector, open Diagnostics and enable Capture detailed timings to record camera callback, culling and command preparation, draw upload, and submission time. Turn it off after diagnosis to remove stage clock reads and the additional scheduled culling completion marker. Visibility, draw, and memory counters remain available. Measurements are elapsed CPU windows, including scheduling and waiting; they are not isolated GPU timings or a sum of worker CPU time.
Scripts can set renderer.CaptureDetailedTimings. Check TerrainGrassStats.DetailedRenderTimingsAvailable before using the last render-stage values; disabled values are unavailable and zero rather than evidence of zero work. The preference belongs to that renderer and does not regenerate grass. Editor performance captures temporarily request timings without changing this preference. Bake and one-time resource measurements are separate.
Settled LOD0, LOD1 and LOD2 chunks can share indirect commands automatically when the owned grass shader is active. Grouping preserves the exact source blade prefixes, species, geometry tier and shadow counts. It requires at least32 eligible chunks within one species and enough equal-prefix groups to remove at least half their commands; each group contains at most16 chunks. Transitions, partial shadow prefixes and shadow-only commands retain their original layout. Custom shaders retain the existing near/mid layout.
Grouping reduces command work without changing density. Cold draw buffers can use less capacity, while an already-used pool retains its larger argument buffers and adds the batch records it needs. Switching back and forth reuses those capacities. Profile representative cameras with their actual shadows and transitions rather than assuming every field benefits equally.
Near/mid decoder variants are selected only for eligible grouped commands. Ordinary commands retain the existing shader path. Variants are created lazily and remain immutable while queued work owns them; release follows their native consumer fences. If a required variant cannot be admitted, the renderer reconstructs the original command layout before upload. Warm ownership adds bounded material/cache capacity in addition to the retained draw buffers; driver and allocator byte peaks are not represented by payload counters.
Coordinated scene rebasing preserves the canonical bounds used by the production indirect path. BRG-specific native ownership remains behind internal qualification and is not used by production requests.
Coverage and shadow budgets
Performance > Coverage budget is optional and disabled by default. Enabling it couples reduced blade density with limits on far minimum pixel width and width scaling. Its initial requested density is 75%, minimum pixel width limit is 1 pixel and width scaling limit is 2. Front-to-back ordering is preferred only when the authored order is Stable. These values can reduce submitted work and coverage; inspect the result before adopting them.
The separate shadow budget starts disabled. When enabled, its initial limits are 60 m and 50% density. It adds casting distance and density caps, including eligible offscreen casters, without changing shadow receiving. Visible-density survivor prefixes can also reduce casters, so the resulting casting density is not fully independent of visible density. Disable the budgets to restore the authored rendering policy; no bake asset changes are required.
Lighter geometry
Performance > Lighter Geometry is optional and disabled by default. Every option changes how grass looks, so compare it in your scene at the target resolution before shipping.
- Camera-facing near blades draw one ribbon (5 triangles, 7 vertices) that turns to face the camera, instead of two crossed ribbons (10 triangles, 14 vertices).
- Reduced near segments draws near blades with 2 segments instead of 3 once a chunk's nearest edge is farther than Reduced near distance (12 m by default). Crossed blades drop from 10 to 6 triangles, and camera-facing ribbons from 5 to 3. Blade height and count are unchanged; bends show fewer joints.
- Camera-facing mid blades draw one triangle (3 vertices) instead of two crossed triangles (6 vertices).
- Simple far tufts draw ultra-far tufts with 3 triangles and 5 vertices instead of 5 and 9.
- Far tuft minimum pixel height and maximum height scale limit how much ultra-far tufts are enlarged. The defaults (6 pixels, 3x) match the standard build. A lower maximum also lets distant terrain coverage engage at shorter distances, because its safety bound uses the same cap.
- Far tufts per pixel drops far tufts by rank once more than this many would land on one screen pixel. 0 keeps every tuft.
Indicative cost on the 300 m benchmark scene at 1080p (Editor-hosted, about 600k visible blades): turning on every option cut grass GPU time from 5.1 to 4.1 ms on an Apple M3 Max and from about 5.5 to 3.9 ms on an RTX 3070 Ti laptop. Camera-facing blades give most of the saving; 2-segment near blades add about 8–10%. Measure your own scene in a Development Player before relying on these numbers.
In shadow passes the camera-facing ribbons face the light. Disabling the card restores the standard blades without regenerating grass.
Depth prepass
Rendering & Distance > Depth Prepass chooses which detail levels draw in a URP depth prepass (used by SSAO, depth priming or Force Prepass). Near Tiers keeps LOD0 and LOD1; Off leaves grass out. Grass outside the prepass still writes depth in its forward pass, but appears in the camera depth texture only after opaques, so SSAO, depth of field, soft particles and water ignore it. When any URP renderer in the active pipeline uses depth priming, every tier stays in the prepass, because primed forward passes only draw where the prepass wrote depth.
Shadow cascades
Each directional shadow cascade renders with its own light matrix. The shadow pass rejects a blade before deformation when its root, padded by the largest possible blade reach, lies outside the cascade being rendered, so each cascade only deforms its own blades. Punctual light shadows keep every blade. When grass casts shadows without a casting budget, the Coverage Budget card shows a reminder.
Bake payload size in builds
Saved bakes reserve spare capacity per chunk so Editor edits can be patched in place. Player builds do not ship that padding: the build writes a compact copy with only active blades to Library/KiwiGrass/Shipped and packages it instead. The copy is rebuilt only when the saved bake changes. Players without streaming also load bakes packed, so blade memory matches the active blade count; a later dirty terrain edit then regenerates the whole field. Streaming Players read the compact copy and expand a chunk's slot only when a runtime edit first writes to it.
Streaming memory
Blades in each chunk are sorted by detail rank, and far detail levels draw only a leading share of them. With Partial Far Residency on (the default), streaming loads just that share for each chunk, based on the nearest streaming camera minus the prefetch distance; beyond the LOD2 band that is the ultra-far density (about 8% with default settings). Chunks within the grass shadow distance stay whole because shadow casters use their own density. When a camera moves close enough that a chunk needs more blades, the next selection reloads it.
Camera moves update the published set in place when the entering chunks fit into slots that neither the current nor the new set uses: they are written straight into the live GPU buffer, and only those chunks are held on the CPU. Slot Headroom Percent (25% by default) adds spare slots to a full publication so this usually succeeds; with 0, moves that bring in more chunks than leave fall back to building a new buffer.
Streaming without a saved bake
With streaming enabled and no bake asset, the renderer generates the field, writes it to a session cache file under Application.temporaryCachePath/KiwiGrass/Streaming while the generation commits, then streams from that file like a saved bake. Terrain edits update a private snapshot of it. The file is deleted when streaming stops or the renderer is released. Writing it costs one sequential write of the full field after each full generation.
Loading screens
Hold TerrainGrassUpdateRegistry.BeginLoadingScope() while a loading screen hides the scene. Upload and publication limits are multiplied by Frame Budget > Loading Upload Multiplier (16 by default) and the step budget rises to Loading Step Budget (50 ms) until every scope is disposed. In the Editor the same boost applies automatically while the Editor is in the background or the Scene view has had no input for two seconds.
Distant terrain coverage
Performance > Distant terrain coverage starts disabled. Its initial settings are 180 m start distance, 2 maximum projected blade pixels, 0.025 minimum view incidence and 0.05 incidence transition. Terrain accuracy and view checks retain geometry around silhouettes; a zero-incidence horizon always retains blades. These defaults are requests, not evidence of a speedup for every scene.
The supported path uses the stock Lit material and one species. Terrain holes, stereo cameras, a nonzero scene-frame offset and diagnostic Resident GPU or BRG requests retain blades. Unavailable, stale or unsupported coverage also retains blades. The Inspector displays the last reported fallback reason; no fallback reason alone establishes that a field has rendered successfully.
Preparation evaluates at most 4,096 terrain samples per presentation frame and retains blades until ready. A fully checked planar terrain can use a two-triangle field. Other terrain uses a grid bounded to 257 samples per edge with a conservative per-cell error mask; unsafe cells keep their blades. Higher-resolution terrain is checked against its source samples rather than assumed flat. Eligibility includes natural and artist height variation, macro height gain and the shader's capped threefold far-height enlargement. This can keep ordinary blades above the requested pixel threshold throughout their authored render range. Profitability sampling examines at most 128 chunks per camera and counts only that sampled work; it does not extrapolate unexamined savings.
Exact planar full chunks can be removed from main submission. Other eligible blades skip deformation and collapse in the shader; their submitted instance counts can remain unchanged. If no eligible subpixel coverage exists, or the estimated replacement does not justify the field triangles, the field is not drawn and blades remain. Compare coverage, hill silhouettes, shadows, depth and motion at the actual application resolution and camera angles. Disabling this option restores the blade path without changing saved blade data.
Automatic GPU budgets
Automatic Quality uses its target FPS as a budget; it does not set the application's frame rate. Renderer-attributed GPU measurements supplied through SubmitAutomaticQualityGpuMeasurement describe grass work. Integrations must supply those measurements; the renderer does not automatically populate them. They remain distinct from whole-frame timings.
The optional Whole-frame GPU Budget starts disabled. It requires supported, enabled Frame Timing Stats and valid completed GPU timings; Kiwi Grass does not change the project's timing setting. Unsupported, missing, zero or stale timing cannot lower density through this budget. CPU and renderer-attributed policies remain separate.
Whole-frame timing includes other rendering. The budget compares stable camera, resolution, quality and grass-generation conditions before and after a density reduction. Moving cameras pause trials and reset comparability. It samples 30 observations on each side and requires at least 3% improvement; otherwise it restores the previous density and stops retrying that workload. This comparison can identify a useful density change, but does not establish isolated grass GPU cost. Test the full scene and disable the option when it does not suit the workload.
Shader build policy
Normal non-Development Player builds omit grass variants reserved for diagnostic artist-wind caching, Resident GPU visibility and BRG/DOTS, plus unreachable far-lighting and platform-specific combinations. The generic no-LOD material fallback remains available. Production requests for the retained diagnostic backends still use their documented fallback.
Development builds retain diagnostic variants by default. For faster ordinary Development builds, set KIWI_GRASS_RETAIN_DIAGNOSTIC_VARIANTS=0 in the build process environment to apply shipping variant pruning. Those builds cannot exercise the stripped diagnostic cache and backend variants. Use KIWI_GRASS_RETAIN_DIAGNOSTIC_VARIANTS=1 or pass -kiwi-grass-retain-diagnostic-variants to Unity when those diagnostic variants are required; explicit retention takes precedence over the fast Development override. Foundation qualification builds always retain diagnostic variants. This retention does not enable an unsupported renderer backend. Editor shader compilation retains diagnostic variants as well.
Set KIWI_GRASS_LOG_SHADER_VARIANTS=1 to report callback counts by pass, stage and compiler platform after a completed build. These counts precede later Unity and render-pipeline stripping; they are not total compiled variants or promised build-time savings. Compare cold and warm builds separately and exercise runtime LOD, lighting, shadows, depth and motion with Strict shader variant matching for the shipping graphics APIs.
Streaming updates and explicit revisions
Streaming updates reuse overlapping resident chunks for one or more species when CPU retention is Automatic and capacity, revision and origin remain compatible. Entering chunks go into free slots of the live buffer when they fit (see Streaming memory); otherwise a transactional copy keeps retained ranges and bounded staging transfers entering ranges. Precise-root layouts, discarded CPU data and incompatible state use full replacement. Source bake assets are unchanged. Compare moving-camera update cost as well as steady rendering; a retained capacity is not a guaranteed frame-time improvement.
Integrations that own every metadata mutation may opt into renderer.UseExplicitMetadataRevisions and call renderer.NotifyMetadataChanged() after each relevant change. Terrain-cache integrations can opt into UseExplicitHoleRevisions and call NotifyHoleContentChanged(region) for changed hole content. These are trusted contracts: missing notifications can leave stale data. Leave them disabled when ownership is incomplete; the default paths preserve detection of supported unnotified mutations.
Preserve compatible Unity Library and shader caches between checks. Use isolated projects for different Editor, graphics API or dependency configurations, and refresh their owned validation inputs before testing. These optimizations do not require a project-wide settings mutation or a new bake.
Still stuck?
Bring the renderer status with you.
Include the Kiwi Grass version, Unity and URP versions, operating system, graphics API, renderer status, Player log, and a minimal reproduction.