Beautliful voxel engine like enshrouded
Use same ambient (0.15, 0.18, 0.25) as voxel PS instead of greener tint. Increase translucency (0.6) to reduce contrast when orbiting around grass. Wrap at 0.85 for balanced lit-side brightness. |
||
|---|---|---|
| shaders | ||
| src | ||
| .gitignore | ||
| blending_experiments.md | ||
| CLAUDE.md | ||
| CMakeLists.txt | ||
| plan_phase4.md | ||
| README.md | ||
| research_connected_meshes.md | ||
| voxel_engine_spec.docx | ||
| voxel_engine_spec.md | ||
BVLE Voxels
Prototype de moteur voxel hybride basé sur Wicked Engine (MIT, C++17, DX12/Vulkan).
Cible : 60+ fps en 1440p, monde de 512×512×256 voxels visibles.
Prérequis
| Outil | Version | Installation |
|---|---|---|
| Windows | 10/11 (x64) | — |
| CMake | 3.19+ | winget install Kitware.CMake |
| Visual Studio 2022 Build Tools | 17.x | winget install Microsoft.VisualStudio.2022.BuildTools |
| Windows SDK | 10.0.26100+ | winget install Microsoft.WindowsSDK.10.0.26100 |
| GPU | DX12 feature level 12.0+ | AMD RDNA 2+ / Nvidia RTX 3060+ recommandé |
Le SDK 10.0.26100 est requis car les headers DX12 fournis par Wicked Engine ne sont pas compatibles avec le SDK 22621.
Installation
# 1. Cloner le dépôt
git clone <url> bvle-voxels
cd bvle-voxels
# 2. Cloner Wicked Engine dans engine/
git clone --depth 1 https://github.com/turanszkij/WickedEngine.git engine
# 3. Configurer CMake
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.26100.0
# 4. Compiler
cmake --build build --config Release --target BVLEVoxels --parallel
# 5. Lancer
./build/Release/BVLEVoxels.exe
Commandes de lancement
| Commande | Description |
|---|---|
BVLEVoxels.exe |
Mode normal (monde procédural, rayon 4 chunks) |
BVLEVoxels.exe debug |
Mode debug face-color (+X=Rouge, -X=Rouge sombre, etc.) |
BVLEVoxels.exe debugdevice |
Active la couche de debug D3D12 |
BVLEVoxels.exe vulkan |
Force le backend Vulkan |
Contrôles
| Touche | Action |
|---|---|
| WASD | Déplacement caméra |
| Espace / Ctrl | Monter / Descendre |
| Shift | Vitesse ×3 |
| Clic droit | Capturer/libérer la souris |
| ~ (tilde) | Console Wicked Engine |
Architecture
bvle-voxels/
├── CMakeLists.txt # Build CMake
├── engine/ # Wicked Engine (git clone --depth 1)
├── src/
│ ├── voxel/ # Bibliothèque VoxelEngine (static lib)
│ │ ├── VoxelTypes.h # Types (VoxelData, PackedQuad, ChunkPos)
│ │ ├── VoxelWorld.h/.cpp # Monde voxel (hashmap, génération Perlin)
│ │ ├── VoxelMesher.h/.cpp # Binary Greedy Mesher CPU
│ │ └── VoxelRenderer.h/.cpp# Renderer GPU-driven + VoxelRenderPath
│ └── app/
│ └── main.cpp # Point d'entrée Win32
├── shaders/ # Sources HLSL
│ ├── voxelCommon.hlsli # Root signature, CB, structs partagés
│ ├── voxelVS.hlsl # Vertex shader (vertex pulling)
│ ├── voxelPS.hlsl # Pixel shader (triplanar + lighting)
│ ├── voxelCullCS.hlsl # Compute: frustum + backface culling
│ └── voxelMeshCS.hlsl # Compute: GPU mesher (binary, baseline)
└── voxel_engine_spec.md # Document de spécification complet (Markdown)
Pipeline de rendu (Phase 2 — GPU-driven)
CPU: mesh dirty chunks (greedy merge) → pack quads + chunkInfo dans mega-buffers → upload GPU
GPU: frustum cull compute → indirect args → DrawInstancedIndirectCount (1 appel = N draws)
Buffers GPU :
| Buffer | Type | Slot | Rôle |
|---|---|---|---|
megaQuadBuffer_ |
StructuredBuffer<PackedQuad> | SRV t0 | 2M quads max (16 MB) |
chunkInfoBuffer_ |
StructuredBuffer<GPUChunkInfo> | SRV t2 | 2048 chunks max |
indirectArgsBuffer_ |
RWStructuredBuffer | UAV u0 | Indirect draw args |
drawCountBuffer_ |
RWByteAddressBuffer | UAV u1 | Compteur atomique de draws |
Caractéristiques Phase 2 :
- Mega-buffer unique pour tous les quads de tous les chunks
- Vertex pulling via
SV_VertexID+ push constants (b999) - Frustum culling CPU (wi::primitive::Frustum)
- Backface culling par face group (6 directions × chunk)
- GPU frustum cull compute shader (prêt, activation via flag)
- GPU mesher compute shader baseline (binary, sans greedy merge)
- Tri des quads par direction de face dans le mesher CPU
- GPU timestamp queries pour benchmark
Phases de développement
- Phase 1 — Setup, meshing CPU, rendu basique
- Phase 2 — GPU-driven pipeline, mega-buffer, culling, compute shaders
- Phase 3 — Texture blending (triplanar, height-based)
- Phase 4 — Toping (rebords, bordures procédurales)
- Phase 5 — Rendu smooth (Surface Nets / Marching Cubes)
- Phase 6 — Ray tracing hybride (RT shadows + AO)
Licence
Wicked Engine est sous licence MIT. Le code spécifique BVLE est propriétaire.