sphere texture mapping error

為{幸葍}努か 提交于 2019-12-06 07:47:39

I had this problem before and it is caused, as you found out by the mipmapping. You're remapping the texture coordinates and at this line there is the seam from u = 1 to 0. This big jump is detected by the mipmapping algorithm and a very low mipmap is chosen, which causes the pixels to have a wrong color. The seam have a thickness of 2 pixels, because mipmapping is determined with the gradient function ddx and ddy of a 2x2 pixelblocks. When the seam is exactly in this block the error occurs.

I solved it by disabling the mipmapping for this geometry, but if you need it you could use the method tex2Dgrad (doc) to repair the gradients at this seam or use tex2Dlod (doc) in the shader and determine the miplevel by yourself.

To me this seems to be a matter of texture wrapping. Have you tried the various options of the D3DRS_WRAPx render state? For example,

IDirect3DDevice9::SetRenderState(D3DRS_WRAP0, D3DWRAP_U);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!