Fix HDR screenshot, reduce sun size, windowed 1080p by default

- Add F6 in-app screenshot saving voxelRT_ directly (bypasses Windows HDR)
- Shrink sun disc (pow 256), glow (pow 64), and haze (pow 8) for subtler sky
- Launch as centered 1920x1080 window instead of maximized
This commit is contained in:
Samuel Bouchet 2026-03-31 14:58:44 +02:00
parent 57ac08f231
commit 8ab908054c
3 changed files with 31 additions and 12 deletions

View file

@ -55,12 +55,13 @@ float3 computeSky(float2 uv) {
sky = lerp(horizonColor, nadirColor, h);
}
// Sun glow near sun direction (soft halo)
// Sun glow near sun direction (compact disc + subtle haze)
float3 L = normalize(-sunDirection.xyz);
float sunDot = saturate(dot(viewDir, L));
float sunGlow = pow(sunDot, 32.0) * 0.4;
float sunHaze = pow(sunDot, 4.0) * 0.15;
sky += float3(1.0, 0.85, 0.5) * (sunGlow + sunHaze);
float sunDisc = pow(sunDot, 256.0) * 0.6; // tight bright disc
float sunGlow = pow(sunDot, 64.0) * 0.2; // narrow glow ring
float sunHaze = pow(sunDot, 8.0) * 0.08; // subtle atmospheric haze
sky += float3(1.0, 0.85, 0.5) * (sunDisc + sunGlow + sunHaze);
return sky;
}

View file

@ -139,19 +139,29 @@ int APIENTRY wWinMain(
wcex.lpszClassName = L"BVLEVoxels";
RegisterClassExW(&wcex);
// Screenshot mode: small minimized window to avoid interrupting user
// Compute window size so the client area is exactly 1920x1080
DWORD style = WS_OVERLAPPEDWINDOW;
int clientW = isScreenshot ? 640 : 1920;
int clientH = isScreenshot ? 480 : 1080;
RECT rc = { 0, 0, clientW, clientH };
AdjustWindowRect(&rc, style, FALSE);
int windowW = rc.right - rc.left;
int windowH = rc.bottom - rc.top;
// Center on screen
int screenW = GetSystemMetrics(SM_CXSCREEN);
int screenH = GetSystemMetrics(SM_CYSCREEN);
int posX = isScreenshot ? 0 : (screenW - windowW) / 2;
int posY = isScreenshot ? 0 : (screenH - windowH) / 2;
HWND hWnd = CreateWindowW(
wcex.lpszClassName,
isScreenshot ? L"BVLE Screenshot" : L"BVLE Voxels - Prototype",
WS_OVERLAPPEDWINDOW,
isScreenshot ? 0 : CW_USEDEFAULT,
isScreenshot ? 0 : 0,
isScreenshot ? 640 : 1920,
isScreenshot ? 480 : 1080,
style,
posX, posY, windowW, windowH,
nullptr, nullptr, hInstance, nullptr
);
// SW_SHOWNOACTIVATE: visible but doesn't steal focus (minimized windows don't render)
ShowWindow(hWnd, isScreenshot ? SW_SHOWNOACTIVATE : SW_SHOWMAXIMIZED);
ShowWindow(hWnd, isScreenshot ? SW_SHOWNOACTIVATE : SW_SHOW);
// Initialize Wicked Engine
application.SetWindow(hWnd);

View file

@ -1433,6 +1433,14 @@ void VoxelRenderPath::Update(float dt) {
renderer.debugBlend_ = !renderer.debugBlend_;
wi::backlog::post(renderer.debugBlend_ ? "Blend debug: ON" : "Blend debug: OFF");
}
if (wi::input::Press(wi::input::KEYBOARD_BUTTON_F6)) {
// In-app screenshot: saves voxelRT_ directly (immune to HDR/SDR mismatch)
static int screenshotIdx = 0;
char fname[64];
snprintf(fname, sizeof(fname), "bvle_screenshot_%03d.png", screenshotIdx++);
wi::helper::saveTextureToFile(voxelRT_, fname);
wi::backlog::post(std::string("Screenshot saved: ") + fname);
}
if (wi::input::Press(wi::input::KEYBOARD_BUTTON_F5)) {
if (!renderer.rt_.isShadowsEnabled()) {
renderer.rt_.setShadowsEnabled(true); renderer.rt_.setShadowDebug(0);