Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Swizzling (computer graphics)

From Wikipedia, the free encyclopedia
Vector computation used in computer graphics
Not to be confused withPointer swizzling.

Incomputer graphics,swizzles are a class of operations that transformvectors by rearranging components.[1] Swizzles can also project from a vector of one dimensionality to a vector of another dimensionality, such as taking a three-dimensional vector and creating a two-dimensional or five-dimensional vector using components from the original vector.[2] For example, ifA = {1,2,3,4}, where the components arex,y,z, andw respectively, one could computeB = A.wwxy, whereuponB would equal{4,4,1,2}. Additionally, one could create a two-dimensional vector withA.wx or a five-dimensional vector withA.xyzwx. Combining vectors and swizzling can be employed in various ways. This is common inGPGPU applications.[3]

In terms oflinear algebra, this is equivalent to multiplying by a matrix whose rows arestandard basisvectors. IfA=(1,2,3,4)T{\displaystyle A=(1,2,3,4)^{T}}, then swizzlingA{\displaystyle A} as above looks like

A.wwxy=[0001000110000100][1234]=[4412].{\displaystyle A.wwxy={\begin{bmatrix}0&0&0&1\\0&0&0&1\\1&0&0&0\\0&1&0&0\end{bmatrix}}{\begin{bmatrix}1\\2\\3\\4\end{bmatrix}}={\begin{bmatrix}4\\4\\1\\2\end{bmatrix}}.}

See also

[edit]

References

[edit]
  1. ^Lawlor, Orion."OpenGL ARB_fragment_program Quick Reference ("Cheat Sheet")". University of Alaska Fairbanks. Retrieved21 January 2014.
  2. ^"Vec3Swizzles". glam. Retrieved29 March 2023.
  3. ^"Introduction to CUDA Programming and Performance Optimization". Retrieved23 December 2024. (Relevant portion starts around 37min)

External links

[edit]


Stub icon

Thiscomputer graphics–related article is astub. You can help Wikipedia byadding missing information.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Swizzling_(computer_graphics)&oldid=1332397165"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp