[SOLVED] How to determine location/entity-name that used deleted texture

Was wondering if there is a way to see which asset, entity or even material that is attempting to find a deleted texture?

All I get is:
launch.js:8069 attempting to use a texture that has been destroyed.

1 Like

I am not sure about that, but after the latest engine release I started getting that error myself on a project of mine.

I am not sure it’s an engine bug though or something I did, need to test more.

1 Like

Do we have a list of the engine releases?
Not sure when the last occurred … if I can grab that info I can - maybe - track back on my ‘check points’

1 Like

Please also check against older engine versions. If there is an engine bug from the release, they will be fixed as high priority.

1 Like

hmm … yes ok - I haven’t been around that yet (dont I have to download the whole repo for then to upload on local server?),

  • but I guess I can change that through devtools, if ‘your’ serverversion?

You can use use_local_enginein the launch tab with old engine versions on our code server.



Thanks, it was able to execute - can take it from here

So is there an issue/bug with the new engine for you?

Water reflection:
https://launch.playcanvas.com/1144354?debug=true (new repo)

1 Like

@mvaligursky Would you be able to take a look at this tomorrow please?

1 Like

@yaustar had a quick look, and this PR introduced the error … possibly by triggering some resize or something, not sure https://github.com/playcanvas/engine/pull/3124

{thx for update - and I have just noticed that things are ok again (as well)} … wait, that was premature

  • I had not put the water reflections back on, anyway >> still not working I am afraid :-/

Hope the last repo will get ok for now, but what to do if I want to export by an older engine release? - still the same as above but without the ‘launch … debug=true’?

Maybe like this: Publishing With Custom Engine

  • in such case, can I then do a normal download of my project and choose to alter the manifest.json?

To me it feels the water project might have a bug in it … when screen resizes, the water render targets get recreated, but it seems they’re not set on cameras / layers till frame later, and so one frame the engine renders with destroyed buffers … and we get these errors:

attempting to use a texture that has been destroyed.

and this when resizing the window

1 Like


Hello - So now I have tried to alter my project to not being dependent on the Water Reflection-shader.
And I am therefore using a compromise. This includes the Warp Sprite example: https://developer.playcanvas.com/en/tutorials/warp-a-sprite-with-glsl/

  • but instead of warping the cutout opacity, I want to warp the Normal map of the material.

At this post in the forum, you reference this:

A quite good approach for coders on my level, and I have already changed two chunk-structures in other projects quite succesfully - just not with this one where I am stuck (using this as chunk inspiration: https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/normalMapFast.frag):

var Warp = pc.createScript('warp');

Warp.attributes.add('wavelength', { type: 'number', default: 1 });
Warp.attributes.add('amplitude', { type: 'number', default: 0.05 });

// initialize code called once per entity
Warp.prototype.initialize = function() {
    var m = this.entity.model.meshInstances[0].material;

    // Replace the opacity texture chunk:
    // https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/opacity.frag
    m.chunks.normalPS = 
       /* "uniform sampler2D texture_opacityMap;\n" +
        "uniform float time;\n" +
        "uniform float amplitude;\n" +
        "uniform float wavelength;\n" +
        "\n" +
        "void getOpacity() {\n" +
        "    vec2 uv = $UV;\n" +
        "    uv.y += sin((uv.x + time) / wavelength) * amplitude;\n" +
        "    dAlpha = texture2D(texture_opacityMap, uv).$CH;\n" +
    "uniform sampler2D texture_normalMap;\n" +
    "\n" +
    "void getNormal() {\n" +    
    "vec2 uv = $UV;\n" +
    "uv.y += sin((uv.x + time) / wavelength) * amplitude;\n" +                
    "vec3 normalMap = unpackNormal(texture2D(texture_normalMap, $UV));\n" +
    "dNormalMap = addNormalDetail(normalMap);\n" +
    "dNormalW = dTBN * dNormalMap;\n" +

    // Replace the emissive texture chunk:
    // https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/emissive.frag
    // Since the opacity chunk is included before the emissive chunk, we don't need to declare
    // time, amplitude and wavelength here.
    m.chunks.emissivePS = 
        "uniform sampler2D texture_emissiveMap;\n" +
        "\n" +
        "vec3 getEmission() {\n" +
        "    vec2 uv = $UV;\n" +
        "    uv.y += sin((uv.x + time) / wavelength) * amplitude;\n" +
        "    return $texture2DSAMPLE(texture_emissiveMap, uv).$CH;\n" +
    this.timer = 0;

// update code called every frame
Warp.prototype.update = function(dt) {
    this.timer += dt;

    // Set our custom uniforms for our chunks
    var m = this.entity.model.meshInstances[0].material;
    m.setParameter('time', this.timer);
    m.setParameter('amplitude', this.amplitude);
    m.setParameter('wavelength', this.wavelength);

ok - so I try to use diffuseMap alongside the normalMap (which is better from: https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/normalMap.frag)

My forked Warp-project:

(@LeXXik ->> you might also be interested in saving your example as useful? … cf above: It/Water reflection now produces 2 errors instead of 1 only - on beforehand, thanks)

1 Like

Do you know who made the vert and frag-chunks?
I hate to land in a place between ‘unknowing’ and ‘seeming lazy’
-> I am neither, and have several times been both learning, and trying out shader-languages.

As far as I know the chunks are openGL right? And as such the code/our code, does not look like this:

The chunks are in GLSL language.

Your best bet here is to look at the engine repo chunks and the examples in the engine examples page. eg https://playcanvas.github.io/#graphics/post-effects.html