The Three.js JSONLoader is experiencing difficulty loading textures

After following the steps outlined in this tutorial to export a .blend file using the Blender exporter packaged with Three.js, I encountered an issue. Despite loading the mesh successfully into my experiment environment, the textures were not displaying as expected. To troubleshoot, I checked that the images were loading correctly by logging their creation in the Loader source of Three.js.

var jLoader = new THREE.JSONLoader();
jLoader.createModel(map.data, function(geometry) {
    var material = new THREE.MeshFaceMaterial(),
    mesh = new THREE.Mesh(geometry, material);

    mesh.scale.set(50, 50, 50);

    scene.add(mesh);
}, map.texturePath);

I used createModel to load the JSON data and map.data contains the exported JSON while map.texturePath points to the directory containing the textures. Despite this setup, the textures were still not rendering properly. Upon inspecting the metadata, I noticed a discrepancy between the actual number of materials and what was indicated in the JSON.

The rendered result showed blank areas where textures should have been displayed. Even after trying different approaches such as adjusting paths and modifying material properties within the JSON, the issue persisted.

Upon further investigation using WebGL-Inspector, I identified errors related to bound buffers and element arrays. The debugging output pointed towards possible inconsistencies or missing values within the JSON structure that could be causing the problem.

If needed, additional details and debug information can be found in the links provided for the working "649" texture and the broken "rust" texture, extracted through WebGL-Inspector analysis.


Edit 3

Using the WebGL-Inspector I have pulled a little more info about the actual calls that are failing. Here is the debug info for the working "649" texture and the broken "rust" texture though the texture doesn't show on the linked pages the data is all there if it helps someone (the textures do show on the WebGL-Inspector on the isolate page, just not on the exported pages I linked).

Answer №1

Upon initial inspection, it appears that there may be incomplete uvs for certain materials causing errors in the webgl inspector usage. Further investigation is required to pinpoint the exact issue, but preliminary analysis suggests that the problem may lie within the JSON file.

Answer №2

It was quite frustrating trying to make this work, but ultimately I had to give up. It seems like there were issues with the model creation process itself - the UVs didn't align properly with the model and exporting was a mess. Despite my efforts, I couldn't resolve these issues. On the bright side, I did succeed in loading other textured models successfully in Blender, which proved that the problem lay specifically with this model.

Answer №3

When exporting from Blender, remember to display the materials array rather than just the metadata. The blender exporter may not save textures automatically unless they are included in the materials. For guidance, consider following steps 2-2 outlined in this tutorial.

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

Guarding Vue.js routes when navigating based on asynchronous authentication state requests

I have integrated Firebase for authentication in my Vue.js application. The main (main.js) Vue component handles the authentication logic as follows: created() { auth.onAuthStateChanged((user) => { this.$store.commit('user/SET_USER&apo ...

Implementing sorting functionality in a list with Vue.js by incorporating an arrow icon in the column using v-bind

Is there a way to implement sorting functionality in Vue.js by clicking on table headers and displaying an arrow to indicate the sorting order? I am struggling with creating a function in Vue for sorting and using v-bind to add the arrow. Can someone guide ...

After being redirected from another page using history() in React, the state is initially set to null but later gets updated to the correct value - Firebase integration

After logging in and being redirected to the profile page, I encounter an error that says 'Unhandled Rejection (TypeError): Cannot read property 'email' of null'. How can I ensure that the state is set before proceeding with any additio ...

Quickly Alter Background Image when Hovered Over

I am looking to enhance my website by having the background image change on mouseover of an object, with the replacement image only showing for a quick moment before returning to the original. Additionally, I want to incorporate a short sound file into the ...

Instructions on allowing the user to enter text for searching through an array of objects, and displaying a message if a match is found. Use only pure JavaScript

As a newcomer to JavaScript, I greatly appreciate the support from everyone on this platform. Thank you in advance for your help! I am currently working on building a basic music app as a learning project in JavaScript. The main goal is to understand how J ...

Avoid using the 'exports' keyword when compiling in Typescript

I recently started learning Typescript, although I am proficient in JS. My inquiry pertains to utilizing modules in TS for coding purposes and then excluding the modules when converting to JS. In traditional JS, I segment functionalities into different fi ...

The CSS legend for a FLOT plot chart is being unexpectedly replaced

I am currently exploring the FLOT plot tool and facing difficulty with the legend display. It seems that the CSS styling for the legend is somehow being overridden in my code, resulting in an undesirable appearance of the legend: Even when I try to specif ...

Arrangement featuring two distinct types of tiles

Looking for a way to achieve this layout using just CSS or a combination of CSS and a little JS. Click on my avatar to see the reference image enlarged =) I've tried using floats and display options but haven't been successful. Take a look at htt ...

What are the conditionals and operations that need to be underscored in this template?

I am new to working with underscore and I need help writing an "each" function for posts where only the latest post is displayed. I understand the basic logic which looks like this <% _.each(posts, function(post, index) { %> <% if(index % 3 == 0 ...

Generating dynamic div elements using jQuery

I am currently working on developing a button that will automatically generate pre-formatted divs each time it is clicked. The divs consist of forms with fields that should already be populated with data stored in JavaScript variables. Example: <d ...

Is it possible for me to include a static HTML/Javascript/jQuery file in WordPress?

My extensive HTML file contains Javascript, jQuery, c3.js, style.css, and normalize.css. I am wondering if I can include this file as a static HTML page within Wordpress. Say, for instance, the file is called calculator.html, and I want it to be accessib ...

Prevent unauthorized AJAX requests from external sources within the Node application

I am looking for a way to prevent AJAX requests from being made outside of my application. I need to ensure that the response is not sent when the AJAX request is initiated from external sources, even if the URL is copied and pasted into a browser. My te ...

PHP displays the array returned by Ajax as "[object Object],[object Object]"

When working with Jquery, I am creating two arrays - one embedded inside the other. Here is an example of what it looks like: arrayOne = [{name:'a',value:1}, {name:'b',value:2}] var arrayTwo = [{name:'foo',value:'blah&ap ...

Acquire the "value" and utilize it within a different function

I am facing a minor issue with my JavaScript code. I have been working on creating a gallery page. In this page, there is an icon that triggers a function called "comment" when clicked. function comment() { var div = document.getElementById("commentdiv") ...

Adding external JavaScript and jQuery files in Nuxt 3: A step-by-step guide

After successfully adding the CSS files in Nuxt 3 and nuxt.config.ts, everything is working as intended. The next step involves determining the ideal folder to add these script files. Any suggestions on the best approach to solve this issue? ...

A guide on tapping into the creation event of an express session

Is there a way to determine when express creates a new session? Specifically, I am utilizing a mongodb session store. I have been encountering an problem related to multiple sessions being generated and I would like to identify the root cause by monitorin ...

Why aren't jQuery events triggering following an AJAX request?

I have created a website that utilizes fading effects to transition between sections while loading new content. One of the features includes enlarging an image upon clicking, which is achieved through a jQuery event trigger. The issue I am facing is that ...

Hiding a Blogger section when its widget is not visible

Take a look at this code: <b:section id='page-list'> <b:widget id='PageList1' locked='false' type='PageList' version='2' visible='true'> </b:widget> </b:section> I wa ...

The Node.js application that uses Express and connects to a MSSQL database is reporting that the database

One of my other applications utilizes express and routes, but for this new app I wanted to simplify it. Despite being confident in the correctness of the connection string, I encountered an issue. script.getQuestions(connection); script.getQuestions = fu ...

Issue with DragControls in Three.js not detecting intersections

My current challenge involves setting up DragControls in my Three.js project. After researching online, I found that the process should be quite simple. The code I have written is as follows: let dragObjects = [obj] const dragControls = new DragControls(dr ...