Skip to content

Fix tools materials in Hammer Level Editor's fullbright mode#85

Closed
Aleph0x wants to merge 52 commits intoFacepunch:masterfrom
Aleph0x:fix-tool-textures
Closed

Fix tools materials in Hammer Level Editor's fullbright mode#85
Aleph0x wants to merge 52 commits intoFacepunch:masterfrom
Aleph0x:fix-tool-textures

Conversation

@Aleph0x
Copy link
Copy Markdown
Contributor

@Aleph0x Aleph0x commented Dec 3, 2025

Resolves #625 by adding specular to all tool materials.

This change enables specular on all tool materials using generic.shader, ensuring the Fullbright path always has a non-zero specular term to work with. The result is that tool surfaces become readable again in Hammer's fullbright without altering how they behave in-game or after a map compile. Their material definitions are also updated to the current generic.shader layout, replacing legacy texture bindings with the modern PBR slots.

Hammer’s Fullbright mode uses ToolsVis.hlsl.

vColor.rgb = vAlbedo * flAmbientCubeFactor * flAmbientCubeAmount + flHeadlightSpec.xxx;

Many tool materials currently have their vAlbedo (LightSim_Albedo) effectively set to [0 0 0]. Since Albedo is zero, multiplying it by the ambient cube factor still gives zero:

vColor.rgb = 0 + flHeadlightSpec.xxx;

This means the ambient contribution is always black, and the only thing making these materials visible in Fullbright is the tiny baked-in flHeadlightSpec term. When specular is disabled on the material, even that small contribution disappears, causing the surface to render almost completely black in the viewport.

This PR also updates their texture bindings. Many tool materials were still using legacy auto-generated bindings like g_tColor and g_tNormal. Recompiling them under the modern shader layout switches them to TextureColor, TextureNormal, and the engine’s default PBR slots.

Image Image

sboxbot and others added 30 commits November 24, 2025 09:05
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
…cene.PhysicsWorld (Facepunch#3433)

Resolves Facepunch/sbox-issues#9598 (Fixes issues where traces in the editor can throw NREs after exiting play mode)
* Skip menu editor code outside of the menu project
* Asset Browser: skip menu project assets in Everything and Recents
Add slight delay because windows may still briefly hold a lock on some files even after the process exited
* Refactor sync script

Use single filter repo call
Use globs instead of python madness
Ensure shallow clone is clean before working on it

* Add dry run option to sync script
* Add public gitattributes
* Fix leaky swapchain when resizing on game mode and dispose of handle after usage
VideoRecorder would get a strong handle copy of the swapchain every frame and retain it, causing native to fail to shutdown the copies from it
Made usage of getting native swapchain consistent on managed on other stuff, doing it like this ensures GC properly disposes of the strong handles even not disposing explicitly

Remove now unused ScreenRecorder.def and ScreenshotService.def

There are still optimizations to swapchain I'd like to send on another commit, game is allocating way more swapchains than needed even without the leak, has two completely different paths depending if you are MSAA or not, this can all be much simpler
https://files.facepunch.com/sampavlovic/1b1811b1/EjDyxbTahs.png

* Remove NativeLayerRenderTarget, was unused and fucked

* Keep it as an ITexture/HRenderTextureStrong in managed so we avoid IDisposable, ReadTextureAsync with ITexture
…h#3449)

* Support instanced tint on Blendable and Material::From( i )

Blendable supports vertex tint color, but was initially intended for world geometry so there was no point in working with instance color, now works fine

https://files.facepunch.com/sampavlovic/1b2611b1/sbox-dev_qkWlvBOXW8.png

* Build shaders
* More robust downloading of artifacts

Don't download to a temp file first
Try to retry download up to 3 times, if it fails
Fail Bootstrap if any download fails

* Fix contentbuilder and shadercompiler not forwarding to stdout
…eleted

Move filter implementation to python so we have more flexibility when implementing filters.
Make sure deleted files are properly filtered by evaluating globs in the filter itself not before.
Make sure deleted LFS files are accounted for by scanning the history of the shallow clone for delete/changed lfs files.
Whitelist some additional shaders.
* Fix terrain seams and optimize

Overlap LODs by one step to fix holes in LOD transitions
Reuse vertices that exist on same key when building diamond square

https://files.facepunch.com/sampavlovic/1b2411b1/8mb.video-eW2-tNb22a60.mp4

* Add NoTile class and make terrain use it
https://files.facepunch.com/sampavlovic/1b2411b1/sbox-dev_R1FwUmLhvu.mp4
https://files.facepunch.com/sampavlovic/1b2411b1/sbox-dev_YhKyIwvhve.mp4

* Sure why not Mr. Robot
* SceneEditorSession: make game vs editor scenes more distinct, Scene is whichever is currently active

* Route prefab update, model reload etc events to both scenes if needed

* SceneTree update checking a bit cleaner

* Bring back GameEditorSessions instead, so undo, selection etc can all be linked 1:1 with scenes again

* tweak and tidy
garrynewman and others added 22 commits November 26, 2025 16:20
ListControlWidget now respects the MaxLengthAttribute by disabling the add button when the collection reaches the specified maximum length. Also updated access rules to include MaxLengthAttribute.

Implements https://github.com/Facepunch/sbox-issues/issues/6361

Co-authored-by: Braxen <braxen@braxnet.org>
Fixes Warning: D:\a\sbox-public\sbox-public\engine\Tools\InteropGen\Writer\ManagerWriter.Imports.cs(133,7): warning CS0162: Unreachable code detected [D:\a\sbox-public\sbox-public\engine\Tools\InteropGen\InteropGen.csproj]
* Make sure our private PR action run also check BuildTool formatting

* Format BuildTools
Co-authored-by: nixx quality <nixx@is-fantabulo.us>
Improved error logging, crash fixes, and light menu tweaks
@Aleph0x Aleph0x changed the title Implements https://github.com/Facepunch/sbox-issues/issues/9500#issue… Fix tools materials in Hammer Level Editor's fullbright mode Dec 3, 2025
@Arcevalis
Copy link
Copy Markdown

Finally. This was getting annoying. +1

@handsomematt
Copy link
Copy Markdown
Member

What do you think @sampavlovic, does this make sense or should we be fixing it in ToolsVis.hlsl

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.

Hammer Editor Tool Materials Appear Black