Anisotropic Filtering

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Anisotropic Filtering

    So I changed gunz to use anisotropic filtering when rendering the map, but it doesn't do anything other than 2 samples. I was wondering, does anyone here have any knowledge on how to increase the amount of samples used during the rendering process(I already tried the typical code that would be used, which will be pasted below this). Any help would be greatly appreciated.

    Code:
    D3DCAPS9 caps;
    RGetDevice()->GetDeviceCaps(&caps);
    
    //af code mip/mag/min filter here
    //this sets anisotropic filtering on textures with a max value of w/e your device supports
    g_pD3DDevice->SetSamplerState(0, D3DSAMP_MAXANISOTROPY, caps.MaxAnisotropy);
    //this sets anisotropic filtering on lightmaps with a max value of w/e your device supports
    g_pD3DDevice->SetSamplerState(1, D3DSAMP_MAXANISOTROPY, caps.MaxAnisotropy);
    //code to show what your device supports
    mlog("Maximum AF Samples Supported by device : %d.\n", caps.MaxAnisotropy);
    //result that i got for my device, showing it does in fact support higher than 2 samples.
    Maximum AF Samples Supported by device: 16
    Example of how it looks (Improved, but you can tell it's only using 2x):
    Last edited by jetman82; 03-07-15 at 05:45 AM.


  2. #2
    Valued Member grandao is offline
    MemberRank
    Feb 2008 Join Date
    RJ - BrasilLocation
    128Posts

    Re: Anisotropic Filtering

    You should set the texture filtering to anisotropic.

    Code:
    //Filtering modes
    //D3DTEXF_NONE  
    //D3DTEXF_POINT 
    //D3DTEXF_LINEAR 
    //D3DTEXF_ANISOTROPIC
    D3DDevice->SetSamplerState(unit, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC); 
    D3DDevice->SetSamplerState(unit, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);

  3. #3
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by grandao View Post
    You should set the texture filtering to anisotropic.

    Code:
    //Filtering modes
    //D3DTEXF_NONE  
    //D3DTEXF_POINT 
    //D3DTEXF_LINEAR 
    //D3DTEXF_ANISOTROPIC
    D3DDevice->SetSamplerState(unit, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC); 
    D3DDevice->SetSamplerState(unit, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
    Hi Grandao, I already did set it to anisotropic.

    //no anisotropy on the mipfilter b/c that's an invalid setting, mip only accepts linear/point/none?
    g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC);
    g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
    g_pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, g_bTrilinear ? D3DTEXF_LINEAR : D3DTEXF_NONE);
    g_pd3dDevice->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC);
    g_pd3dDevice->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_ANISOTROPIC);
    g_pd3dDevice->SetSamplerState(1,D3DSAMP_MIPFILTER, g_bTrilinear ? D3DTEXF_LINEAR : D3DTEXF_NONE);

  4. #4
    Valued Member grandao is offline
    MemberRank
    Feb 2008 Join Date
    RJ - BrasilLocation
    128Posts

    Re: Anisotropic Filtering

    Did you replace all occurrences of these functions in the source for all used texture units?

  5. #5
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by grandao View Post
    Did you replace all occurrences of these functions in the source for all used texture units?
    No sir, only at RBspObject::OnDraw(). Is this not the only place it needs to be applied?

  6. #6
    Valued Member grandao is offline
    MemberRank
    Feb 2008 Join Date
    RJ - BrasilLocation
    128Posts

    Re: Anisotropic Filtering

    RBspObject::Draw should work properly.

  7. #7
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by grandao View Post
    RBspObject::Draw should work properly.
    Strange that it only applies x2. I mean, do i have to set the max anisotropy at a specific location, or can i just do it at the top of the function? Could it possibly be the textures themselves just don't have proper mipmaps?

    Update;

    Turns out whoever made superflip didn't use dds files with mipmaps, but after inserting a dds and generating mipmaps there was still no improvement.
    Last edited by jetman82; 04-07-15 at 04:08 AM.

  8. #8
    Valued Member grandao is offline
    MemberRank
    Feb 2008 Join Date
    RJ - BrasilLocation
    128Posts

    Re: Anisotropic Filtering

    It can be set just once, as long as it isn't changed anywhere else. I don't think it has anything to do with mipmaps. Are you sure its is only at 2x? the picture looks ok for me.

    You can also check if the NVIDIA control panel/ Catalyst is forcing the 2x filtering.

  9. #9
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by grandao View Post
    It can be set just once, as long as it isn't changed anywhere else. I don't think it has anything to do with mipmaps. Are you sure its is only at 2x? the picture looks ok for me.

    You can also check if the NVIDIA control panel/ Catalyst is forcing the 2x filtering.
    Fairly sure it's only at 2x, i tried changing between 2/4/8/16x and didn't see a difference. I'm running an intel igp so i can't check via the control panel, since no intel igp before the hd 4000 has a working anisotropic filtering option (they all have the option for 16x, but the option doesn't work, it has to be done within the game itself). I checked to make sure my igp supports 16xaf and it does, but for some reason it's still not applying 16 samples. Honestly with just 2 samples, af isnt' worth adding to gunz, since it makes maps liek superflip look incredibly ugly.

  10. #10
    Hello! NubPro is offline
    MemberRank
    Dec 2009 Join Date
    C:\DesktopLocation
    1,592Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by jetman82 View Post
    Fairly sure it's only at 2x, i tried changing between 2/4/8/16x and didn't see a difference. I'm running an intel igp so i can't check via the control panel, since no intel igp before the hd 4000 has a working anisotropic filtering option (they all have the option for 16x, but the option doesn't work, it has to be done within the game itself). I checked to make sure my igp supports 16xaf and it does, but for some reason it's still not applying 16 samples. Honestly with just 2 samples, af isnt' worth adding to gunz, since it makes maps liek superflip look incredibly ugly.
    recruits your friends to run tests or get another computer to do it.

  11. #11
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by NubPro View Post
    recruits your friends to run tests or get another computer to do it.
    Already tested with another computer, it's not a issue with my gpu, it's something about the engine. Does gunz even use the mipmaps that exist for the official textures? I'm positive I'm setting the parameters correctly and it's just not applying more samples than 2.

  12. #12
    Ninja Goblin HellSniper is offline
    MemberRank
    Feb 2009 Join Date
    GermanyLocation
    1,791Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by jetman82 View Post
    Does gunz even use the mipmaps that exist for the official textures?
    I think this should answer your question about mipmapping.


    Heres the dds for checking it out yourself
    http://puu.sh/iMPTH.dds

  13. #13
    TBF Guru jetman82 is offline
    MemberRank
    Jan 2009 Join Date
    631Posts

    Re: Anisotropic Filtering

    Quote Originally Posted by HellSniper View Post
    I think this should answer your question about mipmapping.


    Heres the dds for checking it out yourself
    http://puu.sh/iMPTH.dds
    Ty Hellsniper, now Ik it's not the code for mipmapping, rather my implementation of anisotropy. I'm gonna kee working on it though, gunz would look much better with 16x af.

  14. #14
    Novice rfconcerned is offline
    MemberRank
    Nov 2013 Join Date
    1Posts

    Re: Anisotropic Filtering

    Which specs?

  15. #15
    Hakuna Matata bulli10 is offline
    MemberRank
    Feb 2011 Join Date
    697Posts

    Re: Anisotropic Filtering

    I dont think to increase it is a good idea



Page 1 of 2 12 LastLast

Advertisement