Search Unity

Kaiser Mip Map filtering for Texture array?

Discussion in 'General Graphics' started by o1o101, Jul 11, 2018.

  1. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Does anyone know how to make mipmaps use kaiser filtering on an existing texture array? The kaiser filtering is only available on the texture importer which texture arrays do not use. I am not a programmer so I would not know how to write some crazy custom importer... Is there any easy solution to this?

    Thanks in advance!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Where are you getting the textures you're filling the array with? Usually you're importing individual textures in the normal way, then constructing the texture array from those assets. If that's the case, you just need to select Kaiser filtering on those assets, and the copied mip will have it applied.
     
  3. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @bgolus
    The array is being generated via Jason Booths Micro Splat terrain shader. I had a previous custom terrain shader but wanted to go with arrays, one of the things that really helped the crispness of the textures was kaiser mip maps.
    I contacted Jason about this he was quite busy but he mentioned it was only exposed in the texture importer some custom system.
    I am not at the office right now however the method you mentioned sounds promising, if I’m not mistaken they were already set to kaiser but I did not seem to be when they were in the array, does it regen the mip maps possibly?

    Thanks!
     
  4. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @bgolus I mentioned this to Jason, he said the following..
    No, because I don’t just copy the nips, I rather blit the textures to new buffers and reconstruct any missing channels, then generate the mips with unity’s built in function, which doesn’t expose the filter options.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Ah, yes. I seem to remember for MegaSplat he had the option to supply the textures already in the correct layout which would have solved this. But yes, textures generated from script generate the mip maps via the default GPU utilities (which is to say, only via pixel averaging). Jason would have to write his own kaiser downsampling shader and generate the mips one by one, or export the texture to disk, import, and copy back (which is possible, but a path fraught with pain). Jason isn't likely to do that unless he gets a lot of requests for it, he's a staunch believer in the path of good enough. I believe his solution was to use a minor amount of mip biasing.
     
  6. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @bgolus Ahh, that is to bad. Will probably just continue with my own shader then.

    Thanks for the help!
     
  7. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @bgolus Oh, speaking of mip biasing, do you think it would be a large performance hit using a -1 mip bias on 4 terrain textures for newer Apple devices? It really sharpens the terrain up nicely.
     
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    It'll certainly be a performance hit, but I couldn't quantify it with my knowledge. I don't focus on mobile much. To be fair I'm not sure I could quantify the performance impact on desktop or console either, I just know on mobile it'll be more than those platforms as the bandwidth is reduced.
     
    o1o101 likes this.