Create custom mipmap for custom GLSL shader

I am trying to create a mipmap texture load with my custom GLSL shader
here is what I got:
new BABYLON.Texture can provide the mipmap and I am able to load it with
vec4 cd= texture(myLoadTx, vec3(clamp_uv_inv, miplevel));
however I would like to replace the mipmap with certain levels, is there a way to handle it?
for example: get the mipmap data with javascript and replace it with another image

or is there way around it? but be able to customize the mipmap is needed!
I saw this one:

can I do something like that?

Babylon doesn’t directly allow providing custom mipmaps like three.js does. We mostly rely on GL’s generateMipmaps to create those. However, it is possible, though it requires calling internal functions:

Custom mipmaps using engine internal functions | Babylon.js Playground (

Zoom out to see the effect. I took the liberty to copy the texture creation function from the three.js demo :slight_smile:


Thank! I will check it out

1 Like