-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitmap::Sample2D方法有一个像素的偏差 #4
Comments
LonelySilen
pushed a commit
to LonelySilen/RenderHelp
that referenced
this issue
Jan 19, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
复现代码
放大一个checker texture并输出图片:
发现checker texture比预期的位置向左、上平移了一个网格,并在图片的右、下边沿导致拖影。
可能的原因和解决办法
Bitmap::SampleBilinear
方法接收的参数值为(x = u * _w + 0.5f, y = v * _h + 0.5f)
。0.5 <= x <= _w + 0.5, 0.5 <= y <= _h + 0.5
。x1 = floor(x), y1 = floor(y), x2 = ceil(x), y2 = ceil(y)
。如果减去一个像素的偏移,把
Bitmap::SampleBilinear
开头部分的代码修改为:发现上述问题不再出现。
The text was updated successfully, but these errors were encountered: