GLSL built-in function
outerProduct()
Constructs a matrix from a column vector times a row vector.
Demo version: GLSL ES 3.00 / WebGL 2Demo stage: Fragment
Syntax
mat outerProduct(vec column, vec row)Parameters
- column
- Input declared in the signature; match its type and dimensions
- row
- Input declared in the signature; match its type and dimensions
Return value
A matrix with element [column][row] = columnVector[row] * rowVector[column]; its dimensions follow the two vector lengths.
Live example
Edit the code and the preview updates as you type.
What outerProduct does
Constructs a matrix from a column vector times a row vector.
Read the preview
outerProduct(vec2(1.0,0.4),vec2(0.5,1.0)) builds a rank-one transform, so the grid does not show two independent axes. Try vec2(1.0,0.0) as the first vector to remove the q.y variation.
Core call
outerProduct(vec2(1.0,0.4),vec2(0.5,1.0))*vec2(x,y);
This is neither cross nor component-wise multiplication.
Experiment
Change the second vector from vec2(0.5,1.0) to vec2(1.0,0.0). Both output coordinates then depend only on x, so the visible stripes become vertical.