Error: The variable "vertices" has not been defined - Blender's three.js exporter is

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.

Answer №1

Experiment with using the geometry type instead of buffergeometry in the apply modifier and observe if it improves the results.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Implementing form validation and AJAX submission for seamless user interaction

I am seeking a solution to validate my form using ajax and then insert it into the database also utilizing ajax. Although, with the current code, validation messages are displayed, it still performs the insertion. The issue I am encountering seems to be ...

What is the best way to merge shared information within a JSON object while utilizing the Map()

Here is some JSON Data for reference: { "+2555970315763":{ "uid": "u9weKk62GvXu4Yf66HM2TFXDL5S2", "phoneNumber": "+2555970315763", "lastTime": "Mon ...

Combining duplicate key-value pairs in a JSON object into an array using JavaScript

Is it possible to merge value objects with the same key but different values? For example, in this case, "field_template_id": 2 appears twice with different values. This is the original JSON data: { "id": "c2dec94f", "data": [ { "field_temp ...

Storing data in an object or array using Node.js to improve caching efficiency

I'm attempting to store and retrieve information in a node CLI script using either an array or an object. My goal is to have a simple key-value setup where I can fetch usernames by using the ID as the key. The code snippet below shows my attempt, but ...

RSPEC failing to automatically invoke 'to_json' on 'render(json: @instance)'

While testing a controller action in rspec, we encountered an unexpected issue with the json response. Instead of receiving a full json object of the instance as expected, we were getting a partial response. => render(json: @instance) "{\" ...

The ng-repeat directive is causing issues with the functionality of the Angular carousal

I am currently trying to create an Angular carousel for displaying image slides that are coming from an array. However, I am facing issues as it is not functioning as a slider. Does anyone have a solution to fix this problem? //HTML <div id="myCarous ...

What is causing the qtip tooltip to show up on buttons with different ids?

I have a requirement to display tooltips only for specific buttons and not for others. I am facing an issue where the tooltip intended for the TAB button is showing up when hovering over other buttons like FOO and BAR as well. Could this be due to them sha ...

Evaluating operational Angular component - Error: $(...).somename function is not defined

I've encountered an issue while attempting to test my component in Angular. The component itself functions correctly during regular use, but when I try to run the tests using "yarn run test", I receive the following error message: HeadlessChrome 0.0. ...

Populate the svg tag with a nearby image

Is there a way to fill a svg element, like a circle, with an image that users can select from their local computer using an <input type='file'/> input? I am aware of filling a svg element using a pattern: <defs> <pattern id="im ...

Switching the orientation of an iPhone on Chrome can lead to content being cut off

Currently, I am conducting testing on an iPhone XS running iOS 15.6.1 The website seems to function properly on iOS Safari (although untested on Android), however, a problem arises when using Chrome and rotating the screen from landscape to portrait mode. ...

Understanding the expiration time of JSON Web Tokens

When setting an expiration time for a JWT, how can we ensure that a user will not get automatically logged out unless they explicitly click "log out"? Keep in mind that the node.js server may remain up and running indefinitely. ...

Switching the cursor to an image when hovering over an element is causing inconsistency in hover events triggering

Currently, I am attempting to implement an effect that changes the cursor to an image when hovering over a text element and reverts back to the normal cursor upon leaving the text element. However, this functionality is not working as expected when using R ...

Why am I getting the error "TypeError: Object(...) is not a function" when attempting to integrate Vanilla Tilt with React?

Looking for assistance on implementing Vanilla Tilt in my React application, I have referenced the following example: https://codesandbox.io/s/vanilla-tilt-with-react-n5ptm The code snippet I am working with is as follows: import React, { Component, useEf ...

Dismiss the pop-up box by clicking outside its borders

I have created a unique homepage featuring pop-up boxes with login fields. The background dims when a pop-up appears, and the user should be able to close the pop-up by clicking outside the box boundaries. Although the function closeOverlay works when the ...

Tips for displaying a digital keyboard when a webpage loads on iOS Safari

While developing a website, I noticed that the virtual keyboard fails to appear when an input field gains focus during the page load process. As per Apple's policy restrictions, this functionality is not allowed. However, I am interested in finding a ...

Store user inputs from HTML forms into database using Javascript

I'm looking for assistance on how to store this javascript/html form data in a database. My expertise lies in connecting html/php with SQL, and I need guidance on integrating this form submission process. Below is the code snippet that enables users ...

What is the best way to include multiple hostnames and pathnames in a Next.js configuration file for image assets?

My attempt to import multiple images from different hostnames for next/image is not working as expected. In my next.config.js, I have tried the following setup: module.exports = { images: { remotePatterns: [ { protocol: 'https&apos ...

Creating a unique texture on a spherical object using THREE.js

Can a sphere be textured in sections rather than all at once? Just like we can use 6 textures on 6 sides of a cube, is it possible to apply different textures to different parts of a sphere? For example, dividing the sphere into quarters and texturing each ...

Why is the radio button not chosen in the ns-popover popup? The radio button is only selected in the popup of the last column

In my Angular controller, I am trying to set the radio model but it is only appearing in the last column popup of the table. The ns-popover is displayed when clicking on a table column. Here is the Angular Code: var app = angular.module('app', ...

retrieving JSON data within HTML elements

How can I access the JSON values {{u.login}} from HTML instead of just through JavaScript? Currently, I am only able to access them using JS. Is there a way to directly access JSON values in HTML? At the moment, I am getting them as text. Could you please ...