Hotspot texturing: Difference between revisions
(Added a Utilities index.) |
|||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{tabsBar|hotspot texturing}} | {{tabsBar|hotspot texturing}} | ||
'''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. | '''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. | ||
[[File:hotspot_example.jpg|thumb|Example of a structure made with a hotspot texture]] | [[File:hotspot_example.jpg|thumb|Example of a structure made with a hotspot texture]] | ||
Valve used hotspot texturing extensively in the creation of | Valve used hotspot texturing extensively in the creation of {{hla|4}} to create modular geometry with bevelled edges. This feature has now been brought over to {{src|4}}, inspired by the {{src2|4}} implementation. | ||
This feature is only available in {{hammer++|4}} and {{strata hammer|4}}. | This feature is only available in {{hammer++|4}} and {{strata hammer|4}}. | ||
Line 20: | Line 19: | ||
1. Create a texture with rectangular regions. The rectangles can be any size, as long as they are axis aligned. | 1. Create a texture with rectangular regions. The rectangles can be any size, as long as they are axis aligned. | ||
2. Create a <code>.rect</code> file. This is a plaintext file containing the list of rectangles. Place the .rect file beside your [[ | 2. Create a <code>.rect</code> file. This is a plaintext file containing the list of rectangles. Place the <code>.rect</code> file beside your [[VMT]]/[[VTF]]. | ||
Example file that has two rectangles. The origin (0, 0) is from the top left of the texture. | Example file that has two rectangles. The origin (0, 0) is from the top left of the texture. | ||
< | <source lang=js> | ||
Rectangles | Rectangles | ||
{ | { | ||
Line 37: | Line 36: | ||
} | } | ||
} | } | ||
</ | </source> | ||
3. Specify the path to your <code>.rect</code> file in your [[ | {{ tip | Region flags can be defined by adding <code>flagname 1</code> inside a rectangle block. | ||
The following flags work with {{strata hammer|4}} : | |||
* <code>rotate 1</code> Enables regions to be rotated to better match the target surface. | |||
* <code>reflect 1</code> Enables regions to be randomly horizontally flipped. | |||
* <code>alt 1</code> Marks this region as an alternate. When the Alt key is held, only alternate rects are chosen. | |||
}} | |||
3. Specify the path to your <code>.rect</code> file in your [[VMT]] as <code>%rectanglemap</code>. The rect file is assumed to be in the {{path|materials}} folder. | |||
Example: | Example: | ||
< | <source lang=js> | ||
LightmappedGeneric | |||
{ | { | ||
$basetexture "hotspot/hotspot_test" | |||
%rectanglemap "hotspot/hotspot_test" | |||
$surfaceprop "metal" | |||
$alphatest 1 | |||
} | } | ||
</ | </source> | ||
=== Example === | === Example === | ||
Line 61: | Line 68: | ||
== Usage == | == 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. | With a hotspot-ready texture in Hammer, apply the texture and then press the Fit button. Hammer will automatically read the <code>.rect</code> file and apply the hotspotting. | ||
Hammer will try choose the closest matching rectangle within a margin of error. If there | Hammer will try choose the closest matching rectangle within a margin of error. If there are multiple matches for a rectangle, a random one is chosen. Pressing Fit will generate a new random result in this case. | ||
== Utilities == | == Utilities == | ||
{{Xblahmt|4}} | * {{Xblahmt|4}} | ||
[[File:Hotspot editor.png|thumb|392px|XBLAH's Modding Tool - Material Hotspot Editor.]] | [[File:Hotspot editor.png|thumb|392px|XBLAH's Modding Tool - Material Hotspot Editor.]] | ||
Can create or edit material hotspot files (.rect). The editor shows a preview of the hotspots, and is integrated with the File Explorer to make it really easy to create the hotspots. [[XBLAH's_Modding_Tool#Material_Hotspot_Editor|See more]]. | Can create or edit material hotspot files (<code>.rect</code>). The editor shows a preview of the hotspots, and is integrated with the File Explorer to make it really easy to create the hotspots. [[XBLAH's_Modding_Tool#Material_Hotspot_Editor|See more]]. | ||
[[File:RectMaker.png|thumb|392px|RectMaker - Creating and modifying .rect files]] | |||
* [https://github.com/cplbradley/RectMaker RectMaker] | |||
GUI Editor for creation and modification of hotspot .rect files. Supports .vtf files, can save and open .rect files directly, and can open .vmt files. | |||
* [https://github.com/koerismo/Hammer-Hotspots/releases SourceHotspot Addon] | |||
Open-source Blender addon that can generate both .rect files and embedded hotspot resources from a mesh's UV map. Useful for porting DreamUV atlases! | |||
== See also == | == See also == | ||
[https://www.defaultinteractive.co.uk/post/hotspot-texturing More detailed article on hotspot texturing] | * [https://www.defaultinteractive.co.uk/post/hotspot-texturing More detailed article on hotspot texturing] | ||
* Strata specifications for [https://wiki.stratasource.org/modding/overview/vtf-hotspot-resource embedded] and [https://wiki.stratasource.org/modding/overview/vtf-hotspot-text-format textfile] hotspots | |||
[[Category:Material_System]] |
Latest revision as of 03:41, 9 August 2025
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.
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, inspired by the
Source 2 implementation.
This feature is only available in Hammer++ and
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"
}
}

flagname 1
inside a rectangle block.
The following flags work with Strata Hammer :
rotate 1
Enables regions to be rotated to better match the target surface.reflect 1
Enables regions to be randomly horizontally flipped.alt 1
Marks this region as an alternate. When the Alt key is held, only alternate rects are chosen.
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.
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 are multiple matches for a rectangle, a random one is chosen. Pressing Fit will generate a new random result in this case.
Utilities
Can create or edit material hotspot files (.rect
). The editor shows a preview of the hotspots, and is integrated with the File Explorer to make it really easy to create the hotspots. See more.
GUI Editor for creation and modification of hotspot .rect files. Supports .vtf files, can save and open .rect files directly, and can open .vmt files.
Open-source Blender addon that can generate both .rect files and embedded hotspot resources from a mesh's UV map. Useful for porting DreamUV atlases!
See also
- More detailed article on hotspot texturing
- Strata specifications for embedded and textfile hotspots