Encountering an issue while trying to load the JSON file generated by the Blender exporter in three.js r.86.
The setup process went smoothly. To test the exporter, I opened Blender and used the untitled file containing a cube:
https://i.sstatic.net/YZgjo.png
After exporting it without any modifications, it resulted in the following JSON file:
{ // JSON data here }
Uploaded the JSON file to a server, then attempted to load it into a scene with a basic setup.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My first three.js app</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<script src="assets/js/three.js"></script>
<script>
/* JavaScript code snippet */
</script>
</body>
</html>
While the above code displayed the cube as expected, an error occurred when attempting to load the JSON file into the scene. The console showed:
TypeError: vertices is undefined
three.js:33296.5
The error seems to be within the function parseModel( json, geometry )
, expecting a vertices
property not present in the JSON file.
A working solution involves tweaking the "Load the JSON" section to have the JSON file in a JavaScript variable:
// JavaScript code snippet
CSS code snippet here
Javascript library loaded via CDN
Seeking insights on this issue and potential solutions.