Skip to content

Conversation

@ficool2
Copy link
Contributor

@ficool2 ficool2 commented Oct 22, 2025

A problem that many modern maps have to deal with is the dreaded Too many t-junctions to fix up! error. T-junctions are formed to avoid visual seams in touching geometry. The limit is typically hit by heavy usage of func_detail geometry touching the world, or water brushes. Many modern TF2 maps tend to hit this error due to higher density of brush detail.

In VBSP, the limit is dictated by MAX_MAP_PRIMITIVES and MAX_MAP_PRIMINDICES which are both 65536. ("Primitives" is what the fixed up geometry is called internally). Unfortunately, the BSP format stores primitive indexes as unsigned 16-bit integers, which means that these limits cannot be raised without modifying the BSP format, and therefore breaking backwards compatibility.

Rather than a fatal error when hitting the limit, this PR modifies the behavior to issue a warning and continue compiling. In practice, this doesn't appear to have significant side effects, and it's certainly better than having to reduce func_detail usage or convert them to entities etc. This is also better than using -notjunc or -nodetailcracks parameters, as this allows most of the seams to remain fixed.

Note: VBSP++ implements this change, and it has been battle-tested publicly on many maps.

@misyltoad
Copy link
Contributor

Hm... I think I did a different solution for the Half-Life 2 Anniversary update which involved changing how detail brushes deal with tjuncs...

Will have to see if I can dig that out.

@misyltoad
Copy link
Contributor

So what I did there was add an option that essentially just did:

	if ( g_bNoTJuncsDetail )
	{
		if ( f->contents & CONTENTS_DETAIL )
			return;
	}

in FixFaceEdges

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.

2 participants