Intrinsics1 min read
sinh
Computes the hyperbolic sine.
Reading Time
1 min
Word Count
114
Sections
11
Try It Live
Test sinh in a live shader
Open the playground, start from a visual preset, and wire sinh into the fragment stage to see how it behaves with real values.
Open PlaygroundThe sinh function returns the hyperbolic sine of x, defined as (exp(x) - exp(-x)) / 2.
Live Demo
Signature
bwsl
sinh :: (T x) -> T {...}
Where T can be float, float2, float3, or float4.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | T | The input value |
Return Value
Returns the hyperbolic sine of x.
Example
bwsl
pipeline HyperbolicWave {
fragment {
float2 p = input.uv * 2.0 - 1.0;
// Use sinh to exaggerate displacement away from the center
float bend = sinh(p.x) * 0.12;
float band = smoothstep(0.03, 0.0, abs(p.y - bend));
float3 color = lerp(float3(0.04, 0.05, 0.08), float3(0.3, 0.8, 1.0), band);
output.color = float4(color, 1.0);
}
}Common Use Cases
Symmetric Growth
bwsl
// Negative inputs grow negatively, positive inputs grow positively
float signedGrowth = sinh(x * scale);Curve Shaping
bwsl
// Exaggerate values away from zero
float shaped = sinh(centeredValue) / sinh(maxRange);Procedural Distortion
bwsl
// Create a strong signed warp around the center
float2 warped = uv + float2(sinh(uv.x - 0.5), 0.0) * amount;Range
Hyperbolic functions grow quickly. Clamp or scale large inputs when the result feeds colors, texture coordinates, or screen-space positions.
Compiled Output
When compiled to GLSL:
glsl
sinh(x)
When compiled to HLSL:
hlsl
sinh(x)
When compiled to Metal:
metal
sinh(x)