$seamless scale: Difference between revisions
Kestrelguy (talk | contribs) m (added language bar.) |
|||
Line 1: | Line 1: | ||
{{lang|{{PAGENAME}}}}[[Category:List of Shader Parameters|S]] | |||
{{Shaderparam|$seamless_scale|since=Source 2007|shader1=LightmappedGeneric|shader2=WorldVertexTransition|shader3=Lightmapped_4WayBlend}} It was created to sidestep texture stretching issues on [[displacement]] surfaces. Models can use this effect on detail textures only with <code>$seamless_detail</code>. | {{Shaderparam|$seamless_scale|since=Source 2007|shader1=LightmappedGeneric|shader2=WorldVertexTransition|shader3=Lightmapped_4WayBlend}} It was created to sidestep texture stretching issues on [[displacement]] surfaces. Models can use this effect on detail textures only with <code>$seamless_detail</code>. | ||
== Basic | == Basic Syntax == | ||
$seamless_scale <float> | $seamless_scale <float> | ||
Line 24: | Line 25: | ||
} | } | ||
==Additional | ==Additional Parameters== | ||
{{MatParam|$seamless_detail|bool|Enables the effect on [[$detail|detail]] textures with the {{ent|VertexLitGeneric}} shader. Requires <code>$seamless_scale</code> to set the scale of the effect and only applies to the detail texture.}} | {{MatParam|$seamless_detail|bool|Enables the effect on [[$detail|detail]] textures with the {{ent|VertexLitGeneric}} shader. Requires <code>$seamless_scale</code> to set the scale of the effect and only applies to the detail texture.}} | ||
{{todo|What about <code>$seamless_base</code>?}} | {{todo|What about <code>$seamless_base</code>?}} | ||
== Caveats == | == Caveats == | ||
* This is not a total solution—there are still some situations where stretching will occur (such as sudden 90° outcroppings). It's handled as best it can be, though. | |||
* This is not a total | |||
* You can no longer scale the material with the [[Hammer Face Edit Dialog]]. The parameter's value must instead changed in the material itself. | * You can no longer scale the material with the [[Hammer Face Edit Dialog]]. The parameter's value must instead changed in the material itself. | ||
* Hammer's 3D view renders the material itself correctly, but others will stop working. | * Hammer's 3D view renders the material itself correctly, but others will stop working. | ||
* [[$bumpmap|Standard normal mapping]] is supported in {{ | * [[$bumpmap|Standard normal mapping]] is supported in {{csgobranch|4}}, but in other games [[$ssbump|only its self-shadowing cousin]]. | ||
* {{todo|Investigate: Neither seems to work in {{tf2}}}} | * {{todo|Investigate: Neither seems to work in {{tf2|4}}.}} | ||
* | * {{ent|$detail}} textures are unsupported. {{todo|Investigate <code>$seamless_detail</code>.}} | ||
== History == | == History == | ||
According to {{hl2ep2|2}}'s developer commentary, this feature was added in response to difficulties experienced with the creation of the [[antlion]] caves section. The complicated topography of the areas exaggerated a previously bearable material-stretching effect. | |||
According to | |||
This effect is a result of how Source usually handles [[displacements]]: a [[UV map]] is locked to the vertices of a displacement surface, and when a vertex on it is translated the polygons linking it to its neighbours stretch or contract accordingly, carrying the texture with them. This can lead to polygons with squashed textures sitting beside others with stretched and blurred ones; an unpleasant effect. | This effect is a result of how Source usually handles [[displacements]]: a [[UV map]] is locked to the vertices of a displacement surface, and when a vertex on it is translated the polygons linking it to its neighbours stretch or contract accordingly, carrying the texture with them. This can lead to polygons with squashed textures sitting beside others with stretched and blurred ones; an unpleasant effect. | ||
Line 47: | Line 45: | ||
== Matching Texture Scale == | == Matching Texture Scale == | ||
Assuming a texture size of 1024x1024, setting $seamless_scale to 0.0078125 will match the 0.25 scale in hammer. This was achieved by dividing (1 / (texture size * desired scale)). | Assuming a texture size of 1024x1024, setting $seamless_scale to 0.0078125 will match the 0.25 scale in hammer. This was achieved by dividing (1 / (texture size * desired scale)). | ||
Line 60: | Line 57: | ||
Additionally, it appears textures are inverted on the Y axis. | Additionally, it appears textures are inverted on the Y axis. | ||
Revision as of 15:46, 9 May 2022


Template:Shaderparam It was created to sidestep texture stretching issues on displacement surfaces. Models can use this effect on detail textures only with $seamless_detail
.
Basic Syntax
$seamless_scale <float>
LightMappedGeneric { $basetexture Example\Example01 $surfaceprop concrete $seamless_scale 0.005 }
VertexlitGeneric { $basetexture Example\Example01 $surfaceprop concrete $detail "models\props_forest\cliff_detail" $detailscale 4 $detailblendfactor 1 $detailblendmode 0 $seamless_detail 1 $seamless_scale 0.005 }
Additional Parameters
$seamless_base
?Caveats
- This is not a total solution—there are still some situations where stretching will occur (such as sudden 90° outcroppings). It's handled as best it can be, though.
- You can no longer scale the material with the Hammer Face Edit Dialog. The parameter's value must instead changed in the material itself.
- Hammer's 3D view renders the material itself correctly, but others will stop working.
- Standard normal mapping is supported in
CS:GO engine branch, but in other games only its self-shadowing cousin.
- Todo: Investigate: Neither seems to work in
Team Fortress 2.
- $detail textures are unsupported. Todo: Investigate
$seamless_detail
.
History
According to Half-Life 2: Episode Two's developer commentary, this feature was added in response to difficulties experienced with the creation of the antlion caves section. The complicated topography of the areas exaggerated a previously bearable material-stretching effect.
This effect is a result of how Source usually handles displacements: a UV map is locked to the vertices of a displacement surface, and when a vertex on it is translated the polygons linking it to its neighbours stretch or contract accordingly, carrying the texture with them. This can lead to polygons with squashed textures sitting beside others with stretched and blurred ones; an unpleasant effect.
$seamless_scale
separates the material's coordinate system from the vertices of the displacement, allowing it to maintain a regular scale across an entire surface without any designer effort.
Matching Texture Scale
Assuming a texture size of 1024x1024, setting $seamless_scale to 0.0078125 will match the 0.25 scale in hammer. This was achieved by dividing (1 / (texture size * desired scale)).
For example, if texture size was 1024x1024:
- 0.125 = (1 / (1024 * 0.125)) = 1 / 128 = 0.0078125
- 0.25 = (1 / (1024 * 0.25)) = 1 / 256 = 0.00390625
- 0.50 = (1 /(1024 * 0.5)) = 1 / 512 = 0.001953125
- 0.75 = (1 / (1024 * 0.75)) = 1 / 768 = 0.0013020833333333
- 1.00 = (1 / (1024 * 1.0)) = 1 / 1024 = 0.0009765625
- 1.25 = (1 / (1024 * 1.25)) = 1 / 1280 = 0.00078125
Additionally, it appears textures are inverted on the Y axis.