UT please make mipBias work on iOS!

Am really missing this feature…

Unless I missed something in the specs (that is at worst possible but I went through the header files multiple times if I recall right), the required setting is not part of OpenGL ES 1.1 or 2.0 at all, as such its just a API feature not present and nothing can be done about it.

We must never forget that OpenGL ES is about optimized rendering, not repeating the desktop bloat. They cut many OpenGL aspects that only cost performance without offering a gain, with the target of it being a highly efficient standard (also for the hardware makers implementing it) to enable low power high performance gpus

Well damn. Theres nothing that could be done? Because I am finding I just have to turn off mip maps altogether to retain the necessary sharpness of some textures. Slightly grainy is better than completely blurred in my current project.

Setting the Mip Map Filtering to Kaiser reduces the amount of blurring. Not a total solution, but it helps.

I many cases is does, in some other, like stripped textures, it gets worse.
emm, get used to blurryness :confused:

You definitely can’t change the mip bias on ES1… in theory on ES2 you can, but I haven’t been able to get that working yet :slight_smile:

I see mention of TEXTURE_LOD_BIAS in the specification of openGles 2.0

http://www.khronos.org/registry/gles/specs/2.0/es_cm_spec_2.0.24.pdf

That is the same thing as mip bias isn’t it?

We are using a control texture for signed distance glyphs to turn on and off signed distance shader logic ( is the texture being minified or not ). It would be nice if we could use a 2x2 control texture with mip bias rather than a full size 512x512 texture.

That sounds like you want point filtering, not mipmap bias. No?

No, this is something that affects me too. In many cases, I want to use mip maps, but can’t because it gets blurry too soon, yet do need the lower mip map so I can have an easy path for downgrading across multiple devices across different quality settings.

And I think it probably is slightly too aggressive for some projects.

I was talking to snakeylake in particular. (Though hippocoder, your rationale isn’t good either. An external tool will make better low res textures than Unity.) I don’t understand why snakeylake is using mipmaps to begin with.

For our test case we want mip map bias. We’re using a control texture that is white in mip 0 and black in all other mips. We’re using it to detect when the texture is being minimized. We can either use a texture the same size of the texture we’re displaying, or use a small texture with mip bias ( if it worked - it worked for non-mobile builds )

I looked into shader instructions (dFdx) to do this, but learned they weren’t supported by apple or something.

Any other ideas?

Load in a new texture that is lower resolution once it gets a certain distance from the camera?

Does anyone have a solution for this yet?

On a non-Unity project (a Marmalade-based iOS game), I was struggling to get negative mip bias values to work with GLES2, but eventually ended up using this in a GLSL shader:

void main()
{ 
  mediump vec2 dx;
  mediump vec2 dy;
  dx = dFdx(outUV) * fMipBias;
  dy = dFdy(outUV) * fMipBias;
  gl_FragColor = texture2DGradEXT(texture0, outUV, dx, dy) * outCol;
}

Uglier and slower than should be necessary, but it got my bitmap fonts looking decent. Now I need a way to make the same thing work with NGUI fonts through Unity.

(In my experience, the key to scalable bitmap fonts without too much blurring is mipmaps, trilinear filtering, and a mip bias of around -0.5. Without the mip bias, the blurriness is pretty bad)

Edit: Looks like the shader that I thought wasn’t working (just using tex2Dbias) - may actually be OK, after giving it a slightly bigger bias on iOS

Thanks for posting this.

I am struggling in understanding how this works though, could you explain it a little?

In particular I am not really following those dFdx functions and what they are doing and why they are needed.

Also, I’ve not upgraded to Unity 4, anyone test this on 4 or any newer versions? Is it fixed?

I am back at this again…

I tried using your line and I get the error:
GLSL Error in Fragment Shader: ERROR: 0:75: Call to undeclared function ‘texture2DGradEXT’

However there is another funcion called texture2DLod and in the unity editor it actually works, but on the device it comes out pink

Anyone know anything about that?