Babylon downloading assets/Flare.png

Hi
Can anyone tell me why in this example https://www.babylonjs-playground.com/#VS5XS7#0
babylon download this file https://www.babylonjs.com/assets/Flare.png and how to use local file instead downloading it from babylonjs

Hey!

this is because by default this line:

var fireBlast = BABYLON.ParticleHelper.CreateDefault(impact, 100);

Will use the flare as default texture.

You can change it with

fireBlast .particleTexture = newUrl;

Well in this example https://www.babylonjs-playground.com/#VS5XS7#0 in line 117 new texture is set in that way but even that file Flare.png is downloaded from https://www.babylonjs.com/assets/Flare.png so again my question is why it is that and how to set this texture to download locally ?

It looks that this file is downloaded by babylon.js library but I would be glad to know how to set to download it from local server. So my question is why in this example
https://www.babylonjs-playground.com/#VS5XS7#0 is downloaded file Flare.png when in line 117 is
fireBlast.particleTexture = new BABYLON.Texture(“https://raw.githubusercontent.com/PatrickRyanMS/BabylonJStextures/master/ParticleSystems/Explosion/ExplosionSim_Sample.png”, scene); so as you mentioned it should override it and not download this Flare.png ?

So the thing is as soon as you are using the helper you start downloading the texture, so once you replace it, it still has already downloaded the previous one.

You could nevertheless download the particle helper JSON locally and tweak it.

Well forgive me but I’m newbie in babylon and I’m little confused.

  1. So in summary there is no way to prevent download this file if you use particle helper ?
    I see here ParticleHelper and JSON that by particle helper will pick the assets from here: Babylon.js/assets/particles/systems

  2. In this preview https://www.babylonjs-playground.com/#VS5XS7#0 maybe I’m wrong but this file Flare.png is needed for this fire blast effect ?

The reason why is so important to me that anything additional should’nt be downloaded is that I want to use it in advert so every 200-500ms for downloading additional file which isn’t needed is very bad :(.

Hey! No worries we are here to explain :slight_smile:
So if you use the helper it will automatically set a texture for your convenience.

If you do not want that, the best idea is just to use the code of the helper directly:

So something like:

var system;

        if (useGPU) {
            system = new BABYLON.GPUParticleSystem("default system", { capacity: capacity }, scene!);
        } else {
            system = new BABYLON.ParticleSystem("default system", capacity, scene!);
        }

        system.emitter = emitter;
        system.createConeEmitter(0.1, Math.PI / 4);

        // Particle color
        system.color1 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
        system.color2 = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
        system.colorDead = new BABYLON.Color4(1.0, 1.0, 1.0, 0.0);

        // Particle Size
        system.minSize = 0.1;
        system.maxSize = 0.1;

        // Emission speed
        system.minEmitPower = 2;
        system.maxEmitPower = 2;

        // Update speed
        system.updateSpeed = 1 / 60;

        system.emitRate = 30;

        return system;

Thank you very much !!!
I’m impressed not only because speed and many functions of the babylon.js (finally something like Unity but in true js) but also because you just released a new version and you still find time to respond to ordinary users quickly. I hope that babylon.js will continue to grow because at this stage it already looks impressive and personally, I am more convinced to move from Unity to babylon.js

1 Like

There is no ordinary users…Just members of the same community :smiley: