BaseAssetsUrl does not change image path for ParticleHelper


When I use the BABYLON.ParticleHelper and change the BABYLON.ParticleHelper.BaseAssetsUrl to use json files locally, it works for json files but not for images.

Even by creating our own json files with our own images, they will be search on this link:
_rootUrl: ""
instead of a local link

I don’t make a PG, because it will work, since the image search in the PG will point to the right link

You might need to change it as well in BABYLON,.ParticleSystemSet.BaseAssetUrl

1 Like

Ah. I will try that.
I’ll come back and say if it worked.

No it does not change. the path always points to the Babylon assets

would be great if you could share a PG with the JSON and code you use so that I can try to point it at someting else to try and catch the culprit ?

i have not used that property but i have loaded local json files for the particle system and updated a texture using a local path :

var p = new BABYLON.ParticleHelper.ParseFromFileAsync(null, "./brain3dapplication/systems/question2.json", this.scene, false).then(system => {
            this.questionParticles = system;         
            system.particleTexture = new BABYLON.Texture("./brain3dapplication/assets/images/question_particle.png", this.scene);
            system.updateSpeed = 0.01;
            system.targetStopDuration = 1;
            system.emitRate = 30;

1 Like

I don’t have a server to host the json file.

What I do locally, I change the images of rain.json to make snow instead of rain.

And when I load locally the image is non-existent because the path points to Babylon’s assets.

I have prepared a beginning of PG, but I am missing the json file hosting that I do not have.
Locally I use EsayPHP. (I hope to take over a dedicated server in the year 2023)

I tried as @shaderbytes suggests to assign the textures after loading.

It worked like this, but we load a json file locally, the images entered in this json file should be local too, right?. Why should we load a ‘rain.json’ file for example and redefine the texture to something else.

When you load from the PG fire.json, it will look for the corresponding textures without having to redefine the images of the fires.

I don’t think redefining the textures like that is the real solution.

BABYLON.ParticleHelper.CreateAsync("rain", scene, false).then((set) => {[0].particleTexture = new BABYLON.Texture("./textures/Snow.png", this.scene);[1].particleTexture = new BABYLON.Texture("./textures/Snow.png", this.scene);

I ran into this issue as well - see how I worked around it Here

I know you already tried similar, but HTH!

1 Like

Thanks jelster. You confirm that there is indeed a problem. I’d rather not use any hack that could be patched directly in the engine I guess.

Not sure there is a problem as this is working :

You can notice the double slash in the url as it has been defined for both json and assets.

I don’t quite understand this double slash.
In a local link I have no http.

BABYLON.ParticleHelper.BaseAssetsUrl = "../_Projects/Demo/Data/Emitter_Configs/";

do i have to do ?

BABYLON.ParticleHelper.BaseAssetsUrl = "../_Projects/Demo/Data/Emitter_Configs//";

The double slash is a just a way to prove out that we DL from the right URL in the setup of the playground.

You should do something like this:

BABYLON.ParticleHelper.BaseAssetsUrl = 
    BABYLON.ParticleSystemSet.BaseAssetsUrl = "../_Projects/Demo/Data/Emitter_Configs";
1 Like

Whatever I try for a link returns this:

I also tried with "" it returns the same thing: a link to

Whatever I do locally, it fetches the images from and not locally.

On the other hand if I redefine the images with new BABYLON.Texture("../linkLocal/img.png", this.scene); it works

So no, I don’t think it’s working. Your example works because the link points exactly where it should (assets.babylonjs)

If I managed to make it work.

I redefined with:

The documentation misled me. maybe that should be clarified.

In fact, you have to do this for it to work.

BABYLON.ParticleHelper.BaseAssetsUrl = this.rootParticle; // For the json
BABYLON.ParticleSystemSet.BaseAssetsUrl = this.rootParticle; // For the textures
1 Like

I should’ve called out that subtle distinction about going into the base PSS earlier, sorry! Could’ve saved you some time.

Easy to miss

1 Like

No worries @jelster. Don’t be sorry. We can’t think of everything.

My mistake was the slash at the end of my path. and I also had a cache problem.

For the cache problem I usually add "file.json?" But there we cannot do it in the loading of the json

1 Like