You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
537 B
Plaintext

#pragma kernel CSMain
//the position of the object we want to get the height for
// X and Z are the input, we want to get Y as result
struct ObjectPosition
{
float3 position;
};
Texture2D<float4> Input;
SamplerState sampler_linear_clamp;
RWStructuredBuffer<ObjectPosition>results;
[numthreads(1,1,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
results[0].position = float3(results[0].position.x,Input.SampleLevel(sampler_linear_clamp, float2(results[0].position.x,results[0].position.z), 0).r,results[0].position.z);
}