Hotspot texturing: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Tag: Manual revert
(VTFEdit compatible vmt)
Line 46: Line 46:


<syntaxhighlight lang=js>
<syntaxhighlight lang=js>
LightmappedGeneric
"LightmappedGeneric"
{
{
$basetexture  hotspot/hotspot_test
"$basetexture" "hotspot/hotspot_test"
%rectanglemap hotspot/hotspot_test
"%rectanglemap" "hotspot/hotspot_test"
$surfaceprop  metal
"$surfaceprop" "metal"
$alphatest    1
"$alphatest"   "1"
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:33, 2 August 2025

edit
Wikipedia - Letter.png
This article has not been added to any content Wikipedia icon categories. Please help out by Wikipedia icon adding categories.

Hotspot texturing is a method to quickly apply textures to geometry by matching faces to predefined rectangles. This method is especially useful with texture maps consisting of trims and panels, and will allow you to automate a lot of the texture aligning process.

Example of a structure made with a hotspot texture

Valve used hotspot texturing extensively in the creation of Half: Life Alyx to create modular geometry with bevelled edges. This feature has now been brought over to Source 1, inspired by the Source 2 implementation.

This feature is only available in Hammer++ Hammer++ and Strata Hammer Strata Hammer.

Benefits

  • Easy to author: The rectangles in the texture can be created in a consistent and seamless style.
  • Improved performance: Since all the rectangles use the same material, they will only consume one draw call rather than multiple like with traditional textures.
  • Saves file size and VRAM: Don't need multiple textures, it can be packed into one texture instead.
  • Quick to apply: You can just select all faces and press Fit, and the result will be nearly perfect.

Authoring

1. Create a texture with rectangular regions. The rectangles can be any size, as long as they are axis aligned.

2. Create a .rect file. This is a plaintext file containing the list of rectangles. Place the .rect file beside your vmt/vtf.

Example file that has two rectangles. The origin (0, 0) is from the top left of the texture.

Rectangles
{
	rectangle
	{
		min		"0 0"
		max		"512 32"
	}
	rectangle
	{
		min		"512 0"
		max		"768 32"
	}
}
Note.pngNote:A UI editor for this is planned, for now measure these rectangles in your image editor of choice

3. Specify the path to your .rect file in your vmt as %rectanglemap. The rect file is assumed to be in the materials folder.

Example:

"LightmappedGeneric"
{
	"$basetexture"  "hotspot/hotspot_test"
	"%rectanglemap" "hotspot/hotspot_test"
	"$surfaceprop"  "metal"
	"$alphatest"    "1"
}

Example

This is an example grate texture with hotspotting.

Download

Usage

With a hotspot-ready texture in Hammer, apply the texture and then press the Fit button. Hammer will automatically read the rect file and apply the hotspotting.

Hammer will try choose the closest matching rectangle within a margin of error. If there is multiple matches for a rectangle, a random one is chosen. Pressing Fit will generate a new random result in this case.

See also

More detailed article on hotspot texturing