Three.js: Switching generateMipmaps to false results in no texture?

Created on 2 Mar 2012  路  5Comments  路  Source: mrdoob/three.js

Hello All,

I need to load textures with no mipmaps but setting generateMipmaps to false in the texture loader results in no texture? Can anyone explain why this might be?

Question

Most helpful comment

I don't need mipmap for my rendering and succeed to have it working with this texture configuration :

texture.generateMipmaps = false;
texture.magFilter = THREE.LinearFilter;
texture.minFilter = THREE.LinearFilter;

hope it will help.

All 5 comments

Hard to tell, could you share with us some code or even better some live example?

Out of blue: textures and mipmaps depend on texture filtering settings. If you don't have the right combination, it will not work.

By default, everything is set up to be quite robust, but once you start messing with custom values you may create invalid combinations (e.g. any filter with name containing "mipmap" must have mipmap and also image must be power-of-2 sized, which leaves you with just nearest and linear filters if you turn off mipmaps).

I don't need mipmap for my rendering and succeed to have it working with this texture configuration :

texture.generateMipmaps = false;
texture.magFilter = THREE.LinearFilter;
texture.minFilter = THREE.LinearFilter;

hope it will help.

Hi,
I'm experiencing a similar problem disabling the mipmaps generation for a CubeTexture. Here is my code:

    // wrap it up into the object that we need
    var cubeMapOnLoad = function (texture) {
        texture.generateMipmaps = false;
        texture.magFilter = THREE.LinearFilter;
        texture.manFilter = THREE.LinearFilter;
    };
    var cubeMapOnError = function (){};
    var cubemap = THREE.ImageUtils.loadTextureCube(urls, undefined, cubeMapOnLoad, cubeMapOnError);

Specifically, I'm seeing these errors in the cosole:

WebGL: drawElements: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled.

All the images of the cubemap are power-of-2. If I set texture.generateMipmaps = true; the error dissappears.

Anyone having this issue disabling the mipmap generation for cubetextures?

Thanks!

@che1404 loadTextureCube returns a Texture so you can do:

var cubemap = THREE.ImageUtils.loadTextureCube(urls);
cubemap.generateMipmaps = false;
cubemap.magFilter = THREE.LinearFilter;
cubemap.minFilter = THREE.LinearFilter;

Also you are setting manFilter which is not a thing

@benaadams you're right. Stupid me! the manFilter was the issue. Neither me nor my partner saw that.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

filharvey picture filharvey  路  3Comments

boyravikumar picture boyravikumar  路  3Comments

Bandit picture Bandit  路  3Comments

konijn picture konijn  路  3Comments