Direct3D Mip Mapping

Started by
2 comments, last by supergeek2k 22 years, 1 month ago
Hi all I am learning Direct3D and I am attempting to create a common API which will work on both DIrect3D and OpenGL platforms. In OpenGL if I use mipmapping and the GL_LINEAR_MIPMAP_NEAREST minification filter and the GL_LINEAR mag filter textures will look smooth when looked at from an angle although slightly blurred. I am trying to acheive a similary type of mipmapping with Direct3D and I cant seem to get it. I keep getting jagged rough textures when looking at an angle or a distance. I am creating my textures using D3DXCreateTextureFromFileEx like this: hr=D3DXCreateTextureFromFileEx( d3dDevice, filename, 0, 0, 0, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_FILTER_TRIANGLE, D3DX_FILTER_TRIANGLE, 0, NULL, NULL, &d3dtextures[numtextures] ); I have tried with different combinations of filter types and the result is the same. I also set the min and mag filters with SetTextureStageState calls and I have tried every combination of filters that are shown in the DX8 docs. A screenshot of the difference can be seen here: http://www.chilloutmarine.com/ss.html The top image is the result from DirectX and the bottom image is from OpenGL. Any ideas on what I might be doing wrong would be greatly appreciated Thanks alot, Geek
Advertisement
Hey, there! Now I understand your problem because I had the same problem with my project but I am not on my computer so I can''t tell you the exact syntax of the line. You need to set the texture stages for the texture so that the minfilter and maxfilter are set to linear..
Search for the texture stage min and max in the docs to give the exact syntax. After you have that set before you render you should be fine.

~Wavewash
Hi Wave thanks for the response.

I am setting my min and mag filters like this:

d3dDevice->SetTextureStageState(0,D3DTSS_MINFILTER, D3DTEXF_LINEAR);

d3dDevice->SetTextureStageState(0,D3DTSS_MAGFILTER, D3DTEXF_LINEAR);

is this what you are talking about?

This doesn''t seem to help I have also tried this with the different filters and same result.

Or are you talking about something different?

Thanks,
Geek

Well I figured out my problem.
I was setting minification and magnification filter but Direct3D also has a MIP filter for mip map stages. I set my mip filter like this:

d3dDevice->SetTextureStageState(0,D3DTSS_MIPFILTER, D3DTEXF_LINEAR);

and it looks alot better now

Thanks,
Geek

This topic is closed to new replies.

Advertisement