Skip to content

Shader Changes

Blixibon edited this page Aug 24, 2019 · 15 revisions

Mapbase modifies the shaders in various ways, but these changes aren't meant to improve graphical quality as much as they're meant to fix bugs or "improve the mapping experience".

Before we actually get into what these changes are, we need to talk about the caveat of modifying existing shaders:

The Shader Caveat (IMPORTANT)

The Source SDK comes with the original shader source code and files which you could compile yourself, but Source doesn't actually allow modders to change existing shaders for security reasons. You can create new shaders with code from existing shaders, but you can't actually modify existing shaders in the engine. This means you can't add things to the existing LightmappedGeneric, but you can create an identical shader called SDK_LightmappedGeneric with your own changes. This is how Mapbase modifies the shaders. It uses custom SDK_ versions of the original shaders.

The problem is that materials still using the original shaders won't use Mapbase's shader changes, so in order to take advantage of these changes, you must change all of your materials to use the custom shaders.

This isn't too bad since it only needs the VMTs (plain-text material files) to be changed, not the VTFs (actual texture files). Mapbase also already comes with converted versions of all of Half-Life 2/EP1/EP2's VMTs, neatly packed in VPKs and staying at about 2-3 MB total, so you'd only have to worry about this if you're adding custom materials or mounting materials from another game. Mapbase also provides an "installer" that can automatically change all of the materials in a directory to the new shaders.

You could potentially get away with using the original shaders if you don't need Mapbase's shader changes, as there's nothing inherently wrong with them, but they wouldn't look right if they're used alongside modded shaders because features like radial fog and projected texture changes would make them look weird. Rope materials also require the SDK_Cable shader due to some other code changes that make the original Cable unusable.


Actual Shader Changes

These are the changes Mapbase makes with its custom shaders:


Insolence's Alien Swarm/C17:EP1 projected textures

Mapbase uses Alien Swarm/City 17: Episode One projected texture changes from Insolence's repository. You can find more information on the dedicated article.


Downfall's Alien Swarm radial fog

Mapbase uses Half-Life 2: Downfall's implementation of Alien Swarm's radial fog, as opposed to Half-Life 2's planar fog. This means fog is calculated radially and doesn't change as you rotate the camera.


C17:EP1's phong on LightmappedGeneric

Mapbase uses City 17: Episode One's phong on LightmappedGeneric, ported from Insolence's repository. I still haven't figured out what it's supposed to look like.


Alien Swarm ropes (SplineRope)

Mapbase uses Alien Swarm ropes from Half-Life 2: Downfall, including both the SplineRope shader and keyframe_rope itself.


$blendmodulatetexture fixes

Mapbase fixes $blendmodulatetexture not appearing under a flashlight, not working with transforms, and lets it show up in Hammer. It also uses Alien Swarm's shader code.


$phongdisablehalflambert

Mapbase ports this parameter from Alien Swarm, which allows $phong to be used without $halflambert.

Clone this wiki locally