MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ axial_blend()

UVField MayaFlux::Kinesis::axial_blend ( const glm::vec3 &  origin = glm::vec3(0.0F),
float  scale = 1.0F,
float  blend = 4.0F 
)
inline

axial_blend projection: blend of three axis-aligned planar projections

Parameters
originWorld-space tile origin
scaleUV scale applied uniformly to all three planes
blendSharpness of the blend between planes (higher = sharper)
Returns
UVField: glm::vec3 -> glm::vec2

Projects onto XZ, XY, and YZ planes and blends by weights derived from the absolute value of the offset position, raised to blend and normalised. Uses position as a proxy for surface normal, which works well for geometry radiating from the origin. Geometry that is flat or axially aligned may show visible blending artefacts.

The blended UV is a weighted average: XZ plane contributes (x, z) weighted by the Y component. XY plane contributes (x, y) weighted by the Z component. YZ plane contributes (y, z) weighted by the X component.

Definition at line 129 of file UVProjection.hpp.

133{
134 return { .fn = [origin, scale, blend](const glm::vec3& p) -> glm::vec2 {
135 const glm::vec3 d = (p - origin) * scale;
136
137 glm::vec3 w = glm::pow(glm::abs(d), glm::vec3(blend));
138 const float wsum = w.x + w.y + w.z;
139 if (wsum < 1e-6F)
140 return glm::vec2(0.0F);
141 w /= wsum;
142
143 const glm::vec2 uv_xz(d.x, d.z);
144 const glm::vec2 uv_xy(d.x, d.y);
145 const glm::vec2 uv_yz(d.y, d.z);
146
147 return uv_xz * w.y + uv_xy * w.z + uv_yz * w.x;
148 } };
149}
Tendency< D, float > scale(const Tendency< D, float > &t, float factor)
Uniform scaling of a scalar-output tendency.
Definition Tendency.hpp:97

References MayaFlux::Kinesis::Tendency< D, R >::fn, and scale().

+ Here is the call graph for this function: