Tips for exporting 3D objects from 3ds Max Studio for optimal use in Three.js

I am facing an issue with loading a 3D object that I created in 3D Studio Max! When I export it as a .obj file (which generates two files, .obj and .mtl), I have tried using OBJMTLLOADET(), MTLLOADER(), and OBJLOADER() but none of them seem to work. Other objects load successfully, so I believe the problem lies in how I export the object from 3D Max.

Below are the codes I have used in WebGL to load the object:

var loader = new THREE.OBJLoader();
    loader.addEventListener ('load', function(event)
    {
        objModel = event.content;
        objModel.traverse(function(child)
        {
            if (child instanceof THREE.Mesh)
            {
                child.material = new THREE.MeshBasicMaterial
                ({
                    color:0xffffff, wireframe: true
                });
            }
        }); 
        objModel.position.y -80;
        scene.add(objModel);
    });
    loader.load('asteroid.obj');

Next code:

 var loader = new THREE.OBJMTLLoader();
    loader.addEventListener ('load', function(event){
        objModel = event.content;
        objModel.position.x = 80;
        objModel.position.y = -80;
        objModel.position.z = 0;
        objModel.scale.y = 1;
        objModel.scale.x = 1;
        objModel.scale.z = 1;
        scene.add(objModel);
    });
    loader.load('asteroid.obj','asteroid.mtl');

These codes work perfectly fine with other objects, but not with my specific object! Can someone guide me on how to correctly export an object from 3D Studio Max for use in Three.js?

UPDATE: Here is the link to download the object: Download .obj file

Answer №1

It appears that the issue lies in the format of your export file, which consists of polygons rather than triangles. The OBJMTLLoader used in the current implementation requires triangles. One potential solution is to enable a triangulation flag during the exporting process, which should be available in software like 3dsmax.

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

How to integrate Three.js into Angular 14 while managing dependencies

I'm currently working on developing a web app using angular cli and incorporating three.js for enhanced product interaction. Despite watching numerous tutorials, I've been unable to successfully integrate three js into angular 14. It seems to wor ...

When useEffects are linked in such a way that the first one updates a dependency of the second, it can lead to

Modified code block with console logs integrated from approved solution. I have stripped down a search bar component to its simplest form: import React, { useEffect, useRef, useState } from "react"; import axios from "axios"; const re ...

JavaScript Function Not Executed in Bottom Section

I've implemented AngularJS includes in my project. Below is the code snippet from my index.html: <!DOCTYPE html> <html ng-app=""> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> ...

Steps to display a div element periodically at set time intervals

I've created a user greeting message that changes based on the time of day - saying Good Morning, Good Afternoon, or Good Evening. It's working well, but I'm wondering how I can make the message hide after it shows once until the next part o ...

Is it possible to eliminate the array from a property using TypeScript?

Presenting my current model: export interface SizeAndColors { size: string; color: string; }[]; In addition to the above, I also have another model where I require the SizeAndColors interface but without an array. export interface Cart { options: ...

Amend and refresh information using AJAX technology

My code isn't working as expected when I try to use AJAX to retrieve data from an editable form and update it in the database. Can someone help me find the issue? Below is the code I'm using: <?php $query = db_get_list("SELECT * FROM ...

Converting Epoch time to date in NextJS

In my NextJS app, I have a date displayed in a div. <div>{post.createdat}</div> The date is shown in epoch time (1609553315666), indicating the number of seconds that have elapsed since 1970. I'm wondering if there's a way to conver ...

In the world of Vue3 and Vue-Router, accessing parameters using the $route object is a breeze during development, but may prove trick

Struggling with building a Vue3 app for production as 90% of my scripts are broken due to variables being undefined. It's baffling why this happens. One concrete example is: In dev mode, accessing a parameter value in my route using this.$route.param ...

The basic evaluation of jQuery elements does not result in a comparison

Wondering what's going wrong in this code: employee_ids = $('[data-employee_id="'+employee+'"]'); timestamp_ids = $('[data-scheduled_on="'+timestamp+'"]'); var common = $.grep(timestamp_ids, function(element) ...

"Are you greeted with a new tab pop-up on your initial visit

I am trying to display a helpful message in a new tab the first time someone visits my website, but I am encountering issues. Below is the code snippet I am using: <html> <?php $cookie_name = "visited"; $cookie_value = "1"; ...

Revise a catalog when an object initiates its own removal

When rendering a card in a parent component for each user post, all data is passed down through props. Although the delete axios call works fine, I find myself having to manually refresh the page for updates to be displayed. Is there a way to have the UI ...

React component's state is not being correctly refreshed on key events

Currently facing an issue that's puzzling me. While creating a Wordle replica, I've noticed that the state updates correctly on some occasions but not on others. I'm struggling to pinpoint the exact reason behind this discrepancy. Included ...

Steps to sending a request with a custom user agent

In my Angular app, I have successfully implemented server-side pre-rendering with the condition that it will only pre-render if a search bot is sending the request. Now, I need to verify if everything is pre-rendered correctly. However, when I visit my w ...

Encountering a CSS issue during the edit process with PHP and JavaScript

I'm encountering an issue when clicking on the edit button, as my data fetched from the DB should be displayed inside a text field. However, I'm facing a CSS-related error: Uncaught TypeError: Cannot read property 'style' of null Belo ...

How can I set the background of specific text selected from a textarea to a div element?

Is it possible to apply a background color to specific selected text from a Text area and display it within a div? let elem = document.getElementById("askQuestionDescription"); let start = elem.value.substring(0, elem.selectionStart); let selection = ...

Combine two arrays and collapse one of the nested elements

I need help merging two arrays based on ID and flattening one of the objects. I haven't been able to find a solution for my specific case. This is what I'm attempting and what I've managed to achieve so far: const a = { someProperty: &a ...

Ensure that you include validation in the ajax request when loading the message content from a separate file

ajax code for adding data to the database <script type="text/javascript"> $(function() { $(".submit_button").click(function() { var textcontent = $("#content").val(); var dataString = 'content='+ textcontent; if(textcontent=='') ...

Messages in a designated channel that are automatically erased

I have set up a suggestion channel where users can only post links, and the bot will react based on what they post. I've managed to make the bot automatically react to links, but I'm struggling to get it to delete anything that is not a link. I w ...

Are the fetch functions within getStaticProps and getServerSideProps equivalent to the fetch API native to web browsers?

I've been working with Next.js for some time now and I'm questioning the fetch API used in both getStaticProps and getServerSideProps. Below is my understanding of these functions: getStaticProps runs during build time and ISR getServerSidePro ...

Setting URL parameters in a POST request: A guide

Currently, the data in question is structured as JSON within this code snippet. However, I've received feedback indicating that it should actually be implemented as URL parameters. I'm currently facing some difficulties with modifying this to fit ...