Skip to content

Instantly share code, notes, and snippets.

@yanorei32
Last active February 15, 2024 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanorei32/db571ea23662024079bedaf9166b83c8 to your computer and use it in GitHub Desktop.
Save yanorei32/db571ea23662024079bedaf9166b83c8 to your computer and use it in GitHub Desktop.
uniform int horiz_res = 64;
float4 mainImage(VertData v_in) : TARGET {
float ratio = uv_size.y / uv_size.x;
float2 res = float2(horiz_res, horiz_res * ratio);
float2 sampling_pos = (floor(v_in.uv * res) + 0.5) * rcp(res);
return image.Sample(textureSampler, sampling_pos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment