Exporting from Blender to three.js can sometimes result in misaligned object positions

Currently, I am encountering a challenge while exporting a basic scene from Blender to Three.js. Apart from the ongoing struggle with the texture not displaying properly, I have discovered an odd issue with the positioning of objects. The image below showcases how it appears in Blender:

https://i.sstatic.net/rbuj1.jpg

However, when rendered in Three.js, it looks like this:

https://i.sstatic.net/y6gdb.jpg

It is evident that the elements are overlapping each other, and the skybox texture is missing despite being correctly referenced in the json file which includes it as a base64 image. The tools being used are Three.js exporter v 1.5.0, three.js v84, and Blender v 2.77.

Below is my configuration:

https://i.sstatic.net/KbJAM.jpg

Furthermore, here is the code snippet for loading the scene:

var loader = new THREE.ObjectLoader();

loader.load(
    '../dist/landscape.json',
    function (obj) {
        scene.add(obj)
    }
);

While aware that I am adding a scene to another scene using this approach, I attempted to extract children by adjusting the code:

loader.load(
    '../dist/landscape.json',
    function (obj) {
        obj.children.forEach(function(elem) {
            scene.add(elem)
        });
    }
);

Unfortunately, implementing this method only displays half of the objects, without any clear reason why. Additionally, the objects continue to overlap in the rendering. After comparing the positions between the result and the original values in Blender, I noticed differences beyond the standard y/z axis swap – x values were reversed (though not causing the problem), and the rotation of the bridge was removed, resulting in it rendering upside down. This discrepancy has left me perplexed.

To further investigate, attached are the .blend and .json files:

UPDATE: A partial solution was identified – the scale was set to 10 during export, leading to the objects appearing misplaced. However, there are still issues with rotation and alignment compared to the original model. See the updated image here:

https://i.sstatic.net/TBRWb.jpg

Answer №1

Once again, I encountered this issue myself. Even setting the scale at 1 did not resolve it. The root cause was that I had failed to apply object transformations in Blender.

  1. To fix this problem, start by selecting all problematic objects in your Blender file (or simply press A)
  2. Next, press CTRL+A
  3. Choose Rotation & Scale
  4. If needed, also apply Location

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

Issue with TableHead not functioning properly when sorting is requested

I'm currently facing an issue with my table that has clickable row headers for sorting functionality using the onRequestSort function. Unfortunately, it seems like this feature is not working as expected. I have implemented the sorting logic using rea ...

Unlocking the power of translation in React: Implementing Amazon Translate or Google Translate for AXIOS responses

I'm currently working on converting Axios JSON responses in React. Here is the code snippet: axios.get('https://jsonplaceholder.typicode.com/users') .then(res => { ...translation_logic_here setU ...

Sending AJAX Responses as Properties to Child Component

Currently, I am working on building a blog using React. In my main ReactBlog Component, I am making an AJAX call to a node server to get back an array of posts. My goal is to pass this post data as props to different components. One specific component I h ...

PHP script encountering difficulty inserting data into database when AJAX is utilized; functions flawlessly without AJAX

In my "user registration" file, there is a form with the following structure: <form action="" method="POST"> <label for="user" class="control-label">User </label> <input type="text" name="user" class="form-control" id="user" ...

Is there a way to assign retrieved data to the $scope.variable?

I'm relatively new to both JavaScript and Angular. I have a piece of code that fetches data from an API and successfully prints it to the console, but I'm facing issues when trying to assign this data to $scope.saveData. It seems to only work wit ...

Accepting insecure certificates in Chrome with Selenium-Webdriver in JavaScript: A Step-by-Step Guide

After generating a test script using Selenium-IDE in Javascript-Mocha format, I encountered an issue with an insecure certificate when trying to access a remote URL locally. To address the problem, I need to modify the generated TestScript to include Chro ...

Attempting to store an array of JSON objects in the state, and then utilizing the `map` method to render

I'm just starting out with React. Currently, I'm attempting to store an array of JSON objects in the state and then map those items into the component render. I'm feeling a bit lost on how to debug this as there are no console errors showi ...

Conceal a div element after initial visit

There is a button (B) that displays a menu (C) when clicked, and a pop-up (A) that also shows the same menu (C) when clicked. There are 4 tasks to accomplish here. 1) Clicking B reveals C. 2) Clicking A reveals C. 3) Clicking B hides A. 4) A should be hi ...

What is the best way to utilize node exec in synchronous mode?

I have a scenario where I need to run exec synchronously. Is there an alternative method to achieve this without using the deprecated execSync library? Can bluebird promises be used for this purpose? for (var i = 0; i < testCasesLength; i++) { va ...

What could be causing my 3D model to not align with what it's supposed to look like

I have been working on a website using React and Next.js, and I am trying to incorporate a 3D model into my site. After downloading a file in glb format, I noticed some discrepancies between the model I saw on this website and the one displayed on my own w ...

Dynamically enhance the JSON root with additional value

Oh dear, I'm feeling quite perplexed right now. I created a JSON element in the following way: var planet = {"continent": []}; planet.continent.push({name: "Asia", flag: "yes", countries: []}); planet.continent[0].countries.push({name: "Japan", capi ...

Utilize angularjs daterangepicker to refine and sift through data

I am currently utilizing the ng-bs-daterangepicker plugin by ng-bs-daterangepicker and encountering difficulty in filtering when selecting a start date and end date. Below is a snippet of my code: <input type="daterange" ng-model="dates" ranges="range ...

Tips for completing the loading process before the child process finishes executing in node.js

My experience with node.js is still in its early stages. I currently have a setup where a child process is triggered to run a .jar file when I access http://localhost:4000/testjar. The page takes a while to load and only displays the output after the child ...

Is it possible to verify the existence of several arrays of data in a MongoDB database using Node.js?

I'm trying to verify if certain data exists in a database. If the data does exist, I want to set the value of k to 1. global.k = 0 let roll = {roll0:"1616",roll1:"234"} for (let i = 0; i < inputcount; i++) { let obj1 = roll["roll" + i]; const ...

What causes the change in behavior of computeBoundingBox() when switching to a different browser tab while it is loading?

I am currently immersed in a complex project utilizing threejs. In an effort to streamline the process, I need to load an obj file, establish pivot points as parents for the mesh within this obj, and allow users to manipulate and rotate these pivots. The l ...

Transforming an array into a JSON object

I currently have an array structured like this: [ 'quality', 'print-quality: 4', 'x-dimension', 'Value: 21590', 'Value: y-dimension', 'Value: 27940', 'Value: ', 'Valu ...

Fill in a dropdown using the options selected from another dropdown menu

I have developed the following code snippet: User: <select id="sel_depart"> <option value="0">All users</option> <?php $all_users = User::getUsersAdmin(); foreach($all_users as $value){ ?> <option value="<?php ...

NextJS is throwing an error stating that the function file.endsWith is not recognized as a valid

After upgrading from nextJS version 9.x.x to 12.x.x, I encountered the following error. Any assistance would be greatly appreciated. TypeError: file.endsWith is not a function at eval (webpack-internal:///./node_modules/next/dist/pages/_document.js ...

Empty Data Table Search After Refresh While Filter Remains Active

After testing the data tables library using their example code in a jsfiddle, it seems like there might be a bug. To recreate the issue, follow these steps: Open the JS Fiddle link https://jsfiddle.net/t4rphnuc/ Click "Run" In any footer search box, fil ...

Discover the magic of TransformToggle and slideToggle in Javascript, HTML, and CSS

Working on a website coding project and ran into an issue. Trying to utilize an img as a link to slideToggle content. It's working, but I'd like the img to rotate 90deg on the first click and -90deg on the second one. Any solutions are greatly ap ...