Unity: Difference between revisions
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
== Shaders == | == Shaders == | ||
Unity | Unity shaders are written in HLSL. | ||
Unity supports the standard vertex, geometry, | Unity supports the standard vertex, geometry, fragment shader pipeline.<br> | ||
They also have their own variation of surface shaders. | They also have their own variation of fragment shaders called surface shaders which automatically handle lighting.<br> | ||
Compute | Compute shaders are useful for doing parallel computation on the GPU.<br> | ||
Results from | Results from compute shaders can be used on the graphical shaders without being copied back to the CPU.<br> | ||
Revision as of 17:01, 17 August 2019
Shaders
Unity shaders are written in HLSL.
Unity supports the standard vertex, geometry, fragment shader pipeline.
They also have their own variation of fragment shaders called surface shaders which automatically handle lighting.
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.