Firstborn/Library/PackageCache/com.unity.terrain-tools@4.0.5/Editor/TerrainTools/Compute/ImageUtility.compute

25 lines
814 B
Plaintext
Raw Normal View History

2023-03-28 13:24:16 -04:00
//#include "../../../Shaders/NoiseLib/Noise.hlsl"
RWTexture2D<float4> OutputTex;
float4 Constant;
#pragma kernel AddConstant
[numthreads(1, 1, 1)]
void AddConstant(uint3 id : SV_DispatchThreadID)
{
OutputTex[id.xy] = OutputTex[id.xy] + Constant;
}
float4 ValueRanges;
#pragma kernel RemapValues
[numthreads(1,1,1)]
void RemapValues (uint3 id : SV_DispatchThreadID)
{
float4 inLow = float4(ValueRanges.x, ValueRanges.x, ValueRanges.x, ValueRanges.x);
float4 inHigh = float4(ValueRanges.y, ValueRanges.y, ValueRanges.y, ValueRanges.y);
float4 outLow = float4(ValueRanges.z, ValueRanges.z, ValueRanges.z, ValueRanges.z);
float4 outHigh = float4(ValueRanges.w, ValueRanges.w, ValueRanges.w, ValueRanges.w);
OutputTex[id.xy] = outLow + (OutputTex[id.xy] - inLow) * (outHigh - outLow) / (inHigh - inLow);
}