//This algorithm includes auto shift so that the input data is gathered on center
float getIFFT(float2 UV, float targetTextureSize)
{
float targetTexSize = targetTextureSize;
float2 Tex_xy = floor(UV * (targetTexSize - 1)); //transform to integer.
float M = 13; //Only right square texture, preserved data size
float result = 0;
for (float u = 0; u < 13; ++u)
{
for (float v = 0; v < 13; ++v)
{
//float4 tx = microTX.SampleLevel(g_samLinear, float2(u / M, v / M), 0);
float a = MICRO_REAL[u][v];
float b = MICRO_IMAG[u][v];
//float u_ = (((targetTextureSize - 1.0f) / 2.0f - (M - 1.0f) / 2.0f) + u + (targetTextureSize + 1.0f) / 2.0f) % targetTextureSize;
//float v_ = (((targetTextureSize - 1.0f) / 2.0f - (M - 1.0f) / 2.0f) + v + (targetTextureSize + 1.0f) / 2.0f) % targetTextureSize;
float u_ = (507 + u) % 513;
float v_ = (507 + v) % 513;
float theta = 2 * IAN_PI *(Tex_xy.x * u_ / targetTexSize + Tex_xy.y * v_ / targetTexSize);
result += (a*cos(theta) - b*sin(theta));
}
}
result = result / targetTexSize / targetTexSize;
return result;
}
'Cat.Storage > SubCat.Research' 카테고리의 다른 글
Real-time infinite texturing from example - writing reference (0) | 2015.08.10 |
---|---|
Reference Category (0) | 2015.08.10 |
Fourier transform pairs (0) | 2015.07.18 |
FFT & DFT (0) | 2015.07.10 |
What is Filter bank (0) | 2015.06.14 |