How to upload textures to Babylon playground?

Hello all,

I’m trying to create particle system within the Babylon playground.
I’d like to upload a texture from my computer.
Is it possible?
I can see in this playground tutorial https://playground.babylonjs.com/#0K3AQ2#3
That the particles has a texture, but the URL says: texture/flare.png
see image specifically on that part:

What does it mean? How did this texture “get” to his webpage? I mean, I tried loading from my machine by choosing “load texture from file”

image

but I either couldn’t save it… where is the save button??
or if I tried to rename it I get this:
image

I got this also when passing a texture location on my git:
particleSystem.particleTexture = new BABYLON.Texture(“https://github.com/…”, scene);
So I read that I can’t pass a texture from a private repo.
How do you add a texture? Are you creating a public repo / creating a new website for that?

oh… and I’m a complete noob in the web environment.

Thanks you for any help.

You can reference texture from the outside as long as the server accepts CORS requests :slight_smile:

/textures/ folder is here: Babylon.js/Playground/textures at master · BabylonJS/Babylon.js (github.com)

How do I enable that?

Hi, I used a texture from the Pabylon.Js repo

particleSystem.particleTexture = new BABYLON.Texture("https://github.com/BabylonJS/Babylon.js/blob/master/Playground/textures/BJS-logo_v3.png", scene);

Would you say this line of code is supposed to work?
I get the same red textures.

You need to use github raw link :slight_smile:
The primary github domain doesn’t allow cors

You should see an error in your browsers console / dev tools aswell

I saw a tutorial about CORS, and they suggested to use this line of code:
fetch(“http://localhost:8888”).then(a=>a.text()).then(console.log)

These are the errors I get:
image

Where is the browser console when working with Babylon.Js on chrome? Is it in the dev tools?

Hey @Eco_Editor - This doc might help:

1 Like

Thanks @PirateJC that link did help

1 Like