Skip to content

Draw the skybox in a deferred subpass (fixes #162) - #222

Open
BenjaFriend wants to merge 5 commits into
mainfrom
feature/skybox-subpass
Open

BenjaFriend wants to merge 5 commits into
mainfrom
feature/skybox-subpass

Conversation

@BenjaFriend

Copy link
Copy Markdown
Member

Fixes #162.

What this does

  • Cubemap is a normal resource now. Cubemap::Create("Textures/Skybox/Garden"_hs) loads posx/negx/posy/negy/posz/negz (png, jpg, jpeg, tga or bmp) from one folder into a cube image with 6 layers. It replaces the old class that took ten arguments and was not used. All faces must be square and the same size; if not, it logs an error and makes no GPU objects. It makes no GPU objects under --null-render.
  • New SkyboxSubpass. It draws one full screen triangle with no vertex buffer and no depth test. The fragment shader makes a view ray from inverse(projection * view rotation) and samples the cube map. It runs in the deferred pipeline before GeometrySubpass, and it rebuilds its pipeline when the swap chain is resized.
  • deferred.frag discards pixels that have no geometry (G-buffer position.a == 0), so the sky shows through. Without a skybox, those pixels show the black clear color, which looks the same as before.
  • Turning it on: the CUBEMAP pipeline flag adds the skybox to the deferred pipeline, and Engine.cpp sets it. The new [Graphics] Skybox value in EngineConf.ini selects the folder (default Textures/Skybox/Garden). Leave it empty for no skybox.
  • Smaller changes:
    • Added vkCmdDraw to VulkanFunctions.inl.
    • The RenderPipeline descriptor pool now allows swap images × subpasses sets. Before, GeometrySubpass used all of them.
    • Removed UboSkyboxVS.
    • Recompiled skybox.vert/frag.spv and deferred_frag.spv.
    • Credited the Humus Garden skybox (CC BY 3.0) in THIRD_PARTY_NOTICES.md.

Testing

  • Builds with Clang (Debug). All 73 CTest tests pass. check_comment_style.py passes.
  • Sandbox --null-render --unattended --frames 120 --seed 1 exits 0.
  • A windowed GPU run of 120 frames (non-shipping build) exits 0 and logs that the skybox was added. The validation layers were not installed on the test machine, so this run did not use them.
  • Not checked: what it looks like on screen (screen capture did not work under Wayland). Please check which way up the sky is, whether the faces are in the correct places, and the brightness. The sky does not go through the scene's tonemap or gamma.

Not in this PR

  • .hdr and equirectangular cube maps for IBL. Converting them needs its own render or compute pass. This fits with the reflections work.

🤖 Generated with Claude Code

cursoragent and others added 5 commits October 25, 2026 12:18
Graphics no longer links the Vulkan loader. DynamicLibrary is the only
LoadLibrary/dlopen caller. VulkanLoader fills the VK_NO_PROTOTYPES function
table, and a missing runtime exits with code 2.

Co-authored-by: Ben Hoffman <BenjaFriend@users.noreply.github.com>
WinVerifyTrust runs before LoadLibraryExW. A bare name is resolved in
System32, then the executable directory. The current directory and PATH
are not searched.

Co-authored-by: Ben Hoffman <BenjaFriend@users.noreply.github.com>
The project brace style is Allman. clang-format left `{` on the same
line because .clang-format did not set BreakBeforeBraces.

Co-authored-by: Ben Hoffman <BenjaFriend@users.noreply.github.com>
Keep main's clang-format and DesktopWindow, and reapply only the loader calls. Signature checks are opt-in through OpenSigned, which the Vulkan loader uses on Windows.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cubemap is now a resource loaded from one folder with posx..negz faces,
in place of the old ten-argument class that was not used. SkyboxSubpass
draws a full screen triangle before the deferred composite, and the
composite discards pixels that have no geometry. The [Graphics] Skybox
config value selects the folder.

Fixes #162

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix skybox Cubemaps

2 participants