# BaseAssetsUrl does not change image path for ParticleHelper

**URL:** <https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778>\
**Category:** Bugs\
**Created:** [November 17, 2022, 1:02pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778 "2022-11-17T13:02:56Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 17, 2022, 1:02pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/1 "2022-11-17T13:02:56Z")

</div>

Hello,

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: "https://assets.babylonjs.com/particles/textures/"`  
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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 17, 2022, 6:29pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/2 "2022-11-17T18:29:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 17, 2022, 7:19pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/3 "2022-11-17T19:19:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 17, 2022, 7:26pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/4 "2022-11-17T19:26:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 17, 2022, 8:23pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/5 "2022-11-17T20:23:00Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![shaderbytes](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaderbytes/32/174_2.png) [@shaderbytes](https://forum.babylonjs.com/u/shaderbytes)\
**Post date:** [November 17, 2022, 9:20pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/6 "2022-11-17T21:20:34Z")

</div>

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 :

```auto
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;
            system.start();
          

        });

```

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 17, 2022, 9:29pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/7 "2022-11-17T21:29:51Z")

</div>

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)

> **[Babylon.js Playground](https://playground.babylonjs.com/#XQ8H3C%2331)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 17, 2022, 10:23pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/8 "2022-11-17T22:23:59Z")

</div>

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.

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

```

---

<div class="post-metadata">

**Author:** ![jelster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jelster/32/25881_2.png) [@jelster](https://forum.babylonjs.com/u/jelster)\
**Post date:** [November 18, 2022, 2:01am UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/9 "2022-11-18T02:01:50Z")

</div>

I ran into this issue as well - see how I worked around it [Here](https://github.com/jelster/space-truckers/blob/develop/src/systems/setBaseAssetUrl.js)

I know you already tried similar, but HTH!

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 18, 2022, 10:41am UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/10 "2022-11-18T10:41:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 18, 2022, 5:55pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/11 "2022-11-18T17:55:16Z")

</div>

Not sure there is a problem as this is working : [https://playground.babylonjs.com/#XQ8H3C#33](https://playground.babylonjs.com/#XQ8H3C#33)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/a/cae2ed91b8be2ae33d0d6ce5d52bebb9e76e7c17.png)

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

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 18, 2022, 6:09pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/12 "2022-11-18T18:09:45Z")

</div>

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//";`

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 18, 2022, 6:29pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/13 "2022-11-18T18:29:17Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 18, 2022, 6:32pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/14 "2022-11-18T18:32:33Z")

</div>

Whatever I try for a link returns this:

`https://assets.babylonjs.com/particles/textures/textures/Snow.png`

I also tried with `"http://127.0.0.1/RealmCraftingWebGL/_Projects/Demo/Data/Emitter_Configs"` it returns the same thing: a link to `https://assets.babylonjs.com/particles/`

Whatever I do locally, it fetches the images from `assets.babylon.com` and not locally.

On the other hand if I redefine the images with `new this.systems.particleTexture 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)

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 18, 2022, 6:42pm UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/15 "2022-11-18T18:42:01Z")

</div>

If I managed to make it work.

I redefined with:  
BABYLON. **ParticleSystemSet**.BaseAssetsUrl

The documentation misled me. maybe that should be clarified.

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

```auto
BABYLON.ParticleHelper.BaseAssetsUrl = this.rootParticle; // For the json
BABYLON.ParticleSystemSet.BaseAssetsUrl = this.rootParticle; // For the textures

```

---

<div class="post-metadata">

**Author:** ![jelster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jelster/32/25881_2.png) [@jelster](https://forum.babylonjs.com/u/jelster)\
**Post date:** [November 19, 2022, 12:34am UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/16 "2022-11-19T00:34:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [November 19, 2022, 1:01am UTC](https://forum.babylonjs.com/t/baseassetsurl-does-not-change-image-path-for-particlehelper/35778/17 "2022-11-19T01:01:27Z")

</div>

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?"+Date.now()`. But there we cannot do it in the loading of the json
