17 lines
411 B
Text
17 lines
411 B
Text
// Each #kernel tells which function to compile; you can have many kernels
|
|
#pragma kernel Clear3D
|
|
|
|
// Create a RenderTexture with enableRandomWrite flag and set it
|
|
// with cs.SetTexture
|
|
RWTexture3D<half4> _Source;
|
|
uint4 _SourceDim;
|
|
half4 _ClearColor;
|
|
|
|
[numthreads(4,4,4)]
|
|
void Clear3D (uint3 id : SV_DispatchThreadID)
|
|
{
|
|
if (all(id.xyz < _SourceDim.xyz))
|
|
{
|
|
_Source[id.xyz] = _ClearColor;
|
|
}
|
|
}
|