Skip to content

Conversation

@Aleph0x
Copy link
Contributor

@Aleph0x Aleph0x commented Dec 3, 2025

Resolves Facepunch/sbox-issues#9500 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

Resolves Facepunch/sbox-issues#9500 by adding specular to all tool materials.
@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

Finally. This was getting annoying. +1

@handsomematt
Copy link
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

3 participants