I have exported a scene with Three.js Editor which resulted in a file scene.json .
Now I want load this file with the local Web Server.
And apply the data for the scene in the target HTML page.
How to do it?
You’d load a json object scene with
ObjectLoader you can see an example of this in the ObjectLoader documentation
but I do not known about “resource URL”
Hope for advice
This would be the path to your json scene, eg. You’d put your json scene in a folder within your project let’s say a folder named “models” and then load from that directory eg.
loader.load( // resource URL "models/scene.json", ...
What is “your project” ?
I have no node installation and therefore no npm .
I would prefer to use ObjectLoader which a http URL
or with a string containing all content from the .json file.
Have I a chance ?
You have a chance.
- With local web server: Your local web server should be configured to serve a local folder containing your HTML and JSON files. When you access these files, do not use URLs that start with
file://– they will not work for loading resources. Instead, access them via
http://localhost. If you access the HTML page via localhost, then all resource URLs are just relative paths, like
"models/scene.json"as @Lawrence3DPK mentioned.
- With string containing all content from the .json file: This is called DataURI and is applicable for files that are not too big. Find any online DataURI converter (there are many, and they are easy to find), upload your JSON file there, and it should give you one veeeeeery long URL that starts with
data://. Use this URL as resource URL.
I will try itlater