700 Commits over 1,553 Days - 0.02cph!
Fix black cubemap fog on hammer
Cubemap Fog can be tinted, takes tint from main skybox as well https://files.facepunch.com/sam/1b3111b1/XWpxvX189A.png
sky.shader: g_flBrightnessExposureBias and g_flRenderOnlyExposureBias makes no sense when there's tint, barely any existing skyboxes used it properly
Update SkyBox2D component to apply tint to IBL environment probe
https://files.facepunch.com/sam/1b3111b1/G0298YogbO.png
Terrain_Normal: dY was inverted
Reenable terrain specular and recompile it with normal fixes
Terrain_Normal calculates world space normals properly now, remove sobel filter to just a simple bilinear
https://files.facepunch.com/sam/1b2711b1/qNolcysYRH.png
Enable indirect lighting from IBL in volumetric fog shader, can be toggled with volume_fog_ibl_indirect
https://files.facepunch.com/sam/1b2711b1/PIwbCCNGYB.png
Fix IBL not working, Transparency in AmbientColor is used to lerp between artist's decided flat color and IBL/GI, defaults to GI
AmbientLight component defaults to Gray color
Don't implicitly set zfar as infinity, if we want to do so we can do from C# side, but make it respect what we pass as zfar
For legacy hammer maps, take global volumetric fog scale from VolumetricFogController
Fix ortho lights in SceneMapLoader and custom shadow size, note that shadow culling will suck on ortho lights until we change tiled culling to use frusta
Fix shitty jitter and noise in volumetric fog https://files.facepunch.com/sam/1b2211b1/NDCtmFBjFj.jpg
Adjust depth bias for gizmos and debug lines, we have way more granular precision than I thought
Cubemapper Fixes (#1627)
Refactoring and fixes for Cubemapper, cleaned it up, makes it really WYSIWYG
Makes them work on Scene viewport
Updates any time they're dirty
Barriers should be set properly now
Parallax for ambient envmap lighting
Diffuse lighting from envmap should be working properly now
Cubemap feathering is tighter by default now, should fix some "leaks" now that skybox is also a global cubemap
Use two passes for ggx cubemap filtering just like in cubemapper
Use bilinear filtering for SampleEnvironmentMapLevel, worth the tradeoff since we're much faster now
Up sky.shader version
Make SSR reconstruction ghosting less apparent
GGXCubemapBlurHelper::GetFaceAndUVFromDirection was giving mirrored directions, recode it to point to correct direction, GGX skyboxes look very nice now, fixes a few issues specially in low resolutions, up sky.shader version so CI rebuilds textures
Fix terrain clipmaps being generated at the shadow map's position rather than the main camera's when rendering shadows
Make sure light cookie is resident and valid if we're getting it's index for lightbinner
Fix Depth::GetWorldPosition dividing by zero on skyboxes, pass epsilon to it
use Depth::GetWorldPosition on Motion Blur, fix darkening/overbrightening of it based on sample count
Don't try to compile shaders that have missing source files
Do draw opaque objects flagged with no depth prepass, also set correct behaviour for SCENEOBJECTFLAG_NO_Z_PREPASS on actual depth prepass layer
Envmap Ambient Lighting + Sky Envmaps (#1568)
Remove alphatest layers and unused attributes, all done in opaque pass
Depth Fast Path was fucked up with material overrides, disable depth fast path on that batch if we're using material overrides then, this whole system seems complicated to begin with too, additionally material flags were not being updated when you did a SetMaterialOverride
This fixes translucent material overrides rendering as if they were opaque
https://files.facepunch.com/sam/1b2811b1/UNobtq1Qnd.png
Handle translucency flags for material overrides in renderingpipeline
Nullcheck bMaterialOverride
Remove Log.Info from SceneCubemap
Only do SceneCubemap.RenderDirty() when it actually updates rather than every frame
Only clear up light count instead of also envmap count on AllocateLights()
Vulkan: When a swapchain needs an update, update only that specific swapchain rather than all of them, remove that stupid EnsureSwapChainsUpToDate too, fixes resizes on tools looking horrible too
Handle NativeRenderWidget presents outside of Begin/FinishRenderingViews block, a lot of the logic for rendering is in the RenderingViews block and was getting stomped on, the hack we had before only hid that, separates render/present steps cleanly, should fix vulkan crash issues on tools
Make sure we only load skybox if it uses a sky shader, CSkyBoxObjectDesc expects a static input layout and causes validation errors if anything else is assigned, this also makes sure you can only select skybox materials
Only ensure swapchains up to date in tools mode and dont let hostedwidget change videomode, that's also handled by EnsureSwapChainsUpToDate and was causing a vulkan crash
Fix Directional AO shader, it was broken for a while and nobody noticed, add a proper falloff curve to it, I feel like just deleting this and starting new with the new Scene Distance Field AO stuff
Use explicit UAV barriers for cubemapper
Sort envmaps properly
Fix debug vis on Material API
https://i.imgur.com/v1jw9qv.png
Ambient occlusion debug vis
https://files.facepunch.com/sampavlovic/1b2311b1/ao.png
Ensure all swapchains are up to date before doing any rendering rather than when doing it per swapchain when the NativeRenderingWidget renders
Finally get rid of that renderdevice window hack that has been there forever, do SetWindowPos correctly in hostedwidget for main window
Use SizeToParent to set initial window position initially for HostedWidgets
Do an initial clear initialization on FindOrCreateFrameBufferScratchTexture to make sure the data is not garbage, should fix SSR accumulation artifacts specially on multiview
UI-only clears should respect if ( r_ui.GetBool() ) as also per sbox/issues/1575 , will check to make this a clear layer rather than a render layer
Use intermediary texture to avoid collision in filtering generated cubemaps, this should fix the cubemap corruption in certain hardware
Revert to NativeRenderingEngine hack, still need to deal with edge cases, I'm debugging it better
Use Present() which also has logic to handle swapchain size changes for widgets than HandlePendingSwapChainResize()
Fix shitty hack on RenderScene()
Change GetShadowDownsampleLevel to calculate based on the percentage of how much the light is visible on the screen rather than distance heuristics, also adjust CalculateSpotResolution and increase base value
Invalidate light cache when a light moves
Bindless Lightcookies (#1556)
https://files.facepunch.com/sampavlovic/1b0211b1/lightcookies.png
Bindless Cubemaps (#1552)
Disable frustum shadow map culling using volume cullers, the view we render for the shadow is already doing frustum culling so I'm not fully sure if this is doing anything, on CS2 it seems to only be used for barn light shadows anyway ( And with an explicit illumination bounds OOB )? Fixes shadow flickering on props
Fix typo, not meant to pass high precision offset to fog, just direct position
https://i.imgur.com/EGNuSTA.png
Shadow Cache + Time Sliced Shadows (#1535)
Make atmospherics on shadingmodel take position with offset directly, recompile terrain with it, fixes volumetric fog on terrain
Add mutex on read/writing m_CulledLights, guarantees it won't be overwritten twice while doing a callback before finishing rendering next frame or would write while allocating lights
Fix baked fog on scenes, only enable volumetric fog if there are any fog volumes in scene
https://files.facepunch.com/sampavlovic/1b2511b1/image%20%289%29.png
lb_indexed_pointlight_shadows. By default for now, don't cast shadows to indexed point lights if the cvar is set, rarely worth anything useful
Reduce parallel cubemap updates on load, we allocate a new lightbinner for each new parallel view and each of them allocates a lot of new GPU buffers when they should be shared, I'll revisit this after shadowcache
GPU Shadow Culling (#1523)
---------
Co-authored-by: Matt Stevens <matt@mattstevens.co.uk>