


Terrain scanner is based on shader and is rendered by GPU. And asynchronous frame rendering, so it is fast and not stuck.
These thresholds are configurable via ScanConfig (see below).
Add the TerrainScanner scripts (or compiled DLL) into your Unity project's Assets/ folder. The source is located in src/TerrainScanner/ in this repository.
In your scene, attach ActiveScan to a GameObject (for example, the Player or Camera). By default the scanner is triggered with the Q key (see ActiveScan.cs).
Ensure ScanConfig is properly populated at runtime with the required materials and particle prefabs:
scanMaterial (shader for scan wave)markMaterial (instanced shader for marks)markParticle1/markParticle2/markParticle3 (optional particle prefabs)If you're using a mod loader (BepInEx) the plugin can populate these for you at startup.
Most runtime options live in ScanConfig (src/TerrainScanner/Config.cs). Important values:
horizontalCount, verticalCount — sampling grid size. Larger values increase coverage and precision but cost more CPU.gridStep — spacing between samples (meters).sampling_originHeightOffset — how far above the camera/player the ray origin starts. Increase this to scan higher terrain.sampling_maxDistanceShort / sampling_maxDistanceLong — raycast lengths for ground/ledge and long-range tests.steepSpawnProb, midSpawnProb, flatSpawnProb — per-category particle spawn probabilities.Tune these values via the ScanConfigManager or by binding them in your plugin's initialization.
I see only some marks rendered even though scanning detected many hits:
Marks struct layout matches the HLSL Marks StructuredBuffer. Field order and sizes must match.ComputeBuffer is created with the correct stride (use Marshal.SizeOf(typeof(Marks))).SV_DEPTH in the fragment can cause depth conflicts and hide instances). Move depth calculation to the vertex stage or remove manual depth writes.Rays don't reach high cliffs:
sampling_originHeightOffset and sampling_maxDistanceShort.Performance concerns:
UniTask.Yield() to avoid blocking the main thread). If you increase resolution, consider reducing horizontalCount/verticalCount or lowering sample frequency.Planned: an "Intelligent Terrain Scanner" that improves scanning quality while staying performant. High-level goals and design notes:
Energy-based propagation model
Priority-driven exploration
Quantized, memory-efficient state
Safety & termination
Runtime tuning and visualization
ScanConfig so users can tune behavior.Why this helps:
Contributions, issues, and suggestions are welcome. When opening a PR:
This project is licensed under the terms in LICENSE.