| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | void DrawShadowsTab() |
| 1292 | { |
| 1293 | if (!GEngine) |
| 1294 | { |
| 1295 | ImGui::TextDisabled("No engine."); |
| 1296 | return; |
| 1297 | } |
| 1298 | |
| 1299 | Engine::ShadowMapTuning t = GEngine->GetShadowMapTuning(); |
| 1300 | bool changed = false; |
| 1301 | |
| 1302 | ImGui::TextDisabled("Depth-buffer shadow maps (durable fix)."); |
| 1303 | ImGui::TextDisabled("OFF = legacy projected shadows. ON = light-space shadow map (no flicker)."); |
| 1304 | ImGui::Separator(); |
| 1305 | |
| 1306 | changed |= ImGui::Checkbox("Enabled (shadow maps)", &t.enabled); |
| 1307 | ImGui::SameLine(); |
| 1308 | ImGui::TextDisabled(t.enabled ? "(projected path skipped)" : "(projected path active)"); |
| 1309 | |
| 1310 | ImGui::Separator(); |
| 1311 | |
| 1312 | changed |= ImGui::SliderFloat("Darkness", &t.darkness, 0.0f, 1.0f, "%.3f"); |
| 1313 | ImGui::TextDisabled(" lit-colour multiplier where shadowed; lower = darker (1.0 = no shadow)"); |
| 1314 | |
| 1315 | changed |= ImGui::SliderInt("Cascades", &t.cascadeCount, 1, 4); |
| 1316 | ImGui::TextDisabled(" total tiers (omni + frustum); more = crisper across distance"); |
| 1317 | |
| 1318 | changed |= ImGui::SliderFloat("Distance coef", &t.distanceCoef, 0.05f, 1.0f, "%.3f"); |
| 1319 | ImGui::TextDisabled(" frustum-tier far distance as a fraction of view distance (1.0 = full VD)"); |
| 1320 | |
| 1321 | changed |= ImGui::SliderFloat("Split coef", &t.splitCoef, 0.0f, 1.0f, "%.2f"); |
| 1322 | ImGui::TextDisabled(" PSSM blend: 0 = uniform splits, 1 = logarithmic (FP 0.95)"); |
| 1323 | |
| 1324 | ImGui::Separator(); |
| 1325 | ImGui::TextDisabled("Omni near tiers — camera-centred spheres, all-direction coverage"); |
| 1326 | ImGui::TextDisabled("(so a caster behind/beside you still casts a shadow into view)"); |
| 1327 | changed |= ImGui::SliderInt("Omni tiers", &t.omniCount, 0, t.cascadeCount); |
| 1328 | ImGui::TextDisabled(" leading tiers fit a sphere around the camera (0 = pure frustum)"); |
| 1329 | changed |= ImGui::SliderFloat("Omni radius 0", &t.omniCoef0, 0.02f, 0.5f, "%.3f"); |
| 1330 | changed |= ImGui::SliderFloat("Omni radius 1", &t.omniCoef1, 0.02f, 0.8f, "%.3f"); |
| 1331 | ImGui::TextDisabled(" sphere radii as a fraction of the shadow range (ascending)"); |
| 1332 | |
| 1333 | changed |= ImGui::SliderFloat("Bias base", &t.biasBase, 0.0f, 0.0005f, "%.6f"); |
| 1334 | ImGui::TextDisabled(" per-cascade depth bias base*(i+1)^2; raise to kill acne"); |
| 1335 | |
| 1336 | changed |= ImGui::SliderFloat("Far fade (m)", &t.fadeRange, 1.0f, 120.0f, "%.1f"); |
| 1337 | ImGui::TextDisabled(" distant shadows dissolve over this band instead of a hard cut-off"); |
| 1338 | |
| 1339 | static const int resOptions[] = {512, 1024, 2048, 4096}; |
| 1340 | int resIdx = 2; |
| 1341 | for (int i = 0; i < 4; ++i) |
| 1342 | if (resOptions[i] == t.resolution) |
| 1343 | resIdx = i; |
| 1344 | if (ImGui::Combo("Resolution", &resIdx, |
| 1345 | "512\0" |
| 1346 | "1024\0" |
| 1347 | "2048\0" |
no test coverage detected