Unity

From David's Wiki
Revision as of 16:59, 17 August 2019 by David (talk | contribs) (Created page with "__FORCETOC__ == Shaders == Unity Shaders are written in HLSL. Unity supports the standard vertex, geometry, fragments shader pipeline. They also have their own variation o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
\( \newcommand{\P}[]{\unicode{xB6}} \newcommand{\AA}[]{\unicode{x212B}} \newcommand{\empty}[]{\emptyset} \newcommand{\O}[]{\emptyset} \newcommand{\Alpha}[]{Α} \newcommand{\Beta}[]{Β} \newcommand{\Epsilon}[]{Ε} \newcommand{\Iota}[]{Ι} \newcommand{\Kappa}[]{Κ} \newcommand{\Rho}[]{Ρ} \newcommand{\Tau}[]{Τ} \newcommand{\Zeta}[]{Ζ} \newcommand{\Mu}[]{\unicode{x039C}} \newcommand{\Chi}[]{Χ} \newcommand{\Eta}[]{\unicode{x0397}} \newcommand{\Nu}[]{\unicode{x039D}} \newcommand{\Omicron}[]{\unicode{x039F}} \DeclareMathOperator{\sgn}{sgn} \def\oiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x222F}\,}{\unicode{x222F}}{\unicode{x222F}}{\unicode{x222F}}}\,}\nolimits} \def\oiiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x2230}\,}{\unicode{x2230}}{\unicode{x2230}}{\unicode{x2230}}}\,}\nolimits} \)



Shaders

Unity Shaders are written in HLSL. Unity supports the standard vertex, geometry, fragments shader pipeline. They also have their own variation of surface shaders. Compute Shaders are useful for doing parallel computation on the GPU. Results from Compute Shaders can be used on the graphical shaders without being copied back to the CPU.


Compute Shaders

To use a compute shader, add a ComputeShader reference to your C# script. To copy data to and from the GPU, use a ComputeBuffer. You can copy standard floats arrays as well as Unity Vector2, Vector3, and Vector4 structs. <-- Example:

-->