When it comes to AFrame+Three.js, which is more efficient: having numerous meshes with minimal triangles per mesh or having a few meshes with a high number of

Currently working with Aframe 1.0.4 and Three.js 111, I am exploring the performance differences between:

  • Whether it is better to have a few entities with a high number of triangles or many entities with fewer triangles each.

Specifically, I am debating whether it would be more efficient to merge the floors in my scene into one large mesh or keep them separate but smaller entities.

In general, from my understanding:

  • Having numerous entities may create overhead due to loading multiple gltf-models and repetitive tick operations on components, as well as creating excessive draw calls on the GPU in THREE.js.
  • Larger entities might result in longer loading times for gltf-models, potentially heavier raycasting, and possibly more complex transformation management in THREE.js.

Here are some average statistics from my scene:

  • There are approximately 40 entities, including simple structures like floors and walls, as well as more detailed furniture items such as sofas and tables.
  • A typical shelf consists of around 25K triangles.
  • On average, a common floor entity contains about 800 triangles.

With that context, my questions are:

  1. What generally performs better: having a few entities with many triangles or many entities with few triangles?
  2. When considering simple entities like floors, is it more efficient to have a few floors with 1K triangles each or a multitude of floors with only 4 triangles?
  3. Are the assumptions I mentioned earlier accurate?

I am interested in understanding both the performance implications on the THREE.js/GPU side (loading time, draw calls) and also on the Aframe side (raycasting, component overhead). Thank you.

Answer №1

It's more efficient to have 4 floors with 1,000 triangles each rather than having 1,000 individual meshes. This approach will help optimize rendering performance by reducing the number of draw calls. It's also beneficial for physics calculations, as using larger meshes instead of many small ones can improve collision calculations efficiency when dealing with static geometry.

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

Determining whether the user has a token stored in the localStorage is a crucial step in my

I have an app that calls a Login API and returns a token. I store the token in localStorage, but I'm unsure how to validate if the user has a token to log in. What steps can I take to solve this? Below is my login page where I store the token in loca ...

Display or conceal component based on specific URL in React.js navigation bar

Hey there, I'm facing an issue with hiding certain links in the navbar when users visit specific pages. For instance, on the Landing page, I want to hide the Orders and Basket links and only show the Login link. I'm having trouble figuring out ho ...

Ajax refreshes page to default state post search

I have implemented a live search feature that retrieves relevant information from the database and displays it in a table using Ajax to avoid page refresh. Currently, after each search, the results reset back to nothing until another input is received. How ...

Updating choices within a div in real-time by changing the select box dynamically

I need to swap out the select box that is nested inside this div <div class="models"> <select disabled="disable"> <option>Model Name</option> </select> </div> I am attempting to target the div and manipul ...

What is the best way to ensure that the same information is included on every page of

Currently developing a dynamic website where certain components such as the fixed header, menubar, and footer are common across multiple pages. What is the best way to include these fixed components on every webpage? I am utilizing JSP and JavaScript for ...

Buefy: Secure the header of the table in place while allowing the rows to scroll freely

How can I make the header of the table component stay fixed while allowing only the rows to scroll? ...

Switching Angular fxLayout from row to column based on a conditional statementHere is an explanation of how to

Visit this link for more information Is there a way to set direction based on a specific value? <div if(value) fxLayout='row' else fxLayout='column'> ...

Utilizing MongoDB embedded documents to gather interconnected attributes within a single container

Would it be advisable to utilize MongoDB embedded documents to consolidate related fields into one? For instance, instead of having separate fields for creator_id and creator_language, could they be replaced with an embedded document creator containing fi ...

Searching for matching strings in jQuery and eliminating the parent div element

Here's an HTML snippet: <div id="keywords"> <div id="container0"> <span id="term010"> this</span> <span id="term111"> is</span> <span id="term212"> a</span> <span ...

Customizing the Switch component individually for each item fetched from an API in React Native

I'm struggling with setting the switch button individually for each item in my API. Despite trying multiple solutions, none of them seem to work for me. const results = [ { Id: "IySO9wUrt8", Name: & ...

Can WikiData be accessed by providing a random pageId?

My current project involves creating a Wikipedia Search App with a 'Feel Lucky' button. I have been trying to figure out if it's possible to send a request for Wikidata using a specific pageid, similar to the code below: async function lucky ...

Instructions for incorporating highcharts sub modules into a React application

I have been utilizing the react-jsx-highcharts library to seamlessly integrate Highcharts into my React application. Everything is functioning perfectly. However, I am now interested in incorporating the boost module. I attempted to add it by simply using ...

Give a radio button some class

<input id="radio1" type="radio" name="rgroup" value="1" > <label for="radio1"><span><span></span></span>1</label> <input id="radio2" type="radio" name="rgroup" value="2" > <label for="radio2"><span ...

What is the mechanism behind range traversal in Javascript?

Exploring the createRange() function and related constructs in Javascript has sparked my curiosity about its practical applications. During my search, I stumbled upon an interesting application called "" that allows users to highlight text with mouse clic ...

Transferring information from a form without using specific authorization

Objective: The objective is to display data from a form where users input their name and favorite band. Upon submission, they will be redirected to a new page which will show: Name: John Doe Favorite Band: The Who Challenge: I am unable to utilize the ...

Clear the page refresh value in javascript once the jquery ajax action is completed

Under specific circumstances, a jQuery ajax query is utilized to show a message on the page. By clicking "close" on the message, it will vanish. Additionally, there is JavaScript on the same page that triggers an automatic refresh every 30 seconds. My go ...

Tips for avoiding html entities in a string

To prevent any user-entered content from being interpreted as HTML, I need to escape it so that special characters like < become < in the markup. However, I still want to wrap the escaped content with actual HTML tags. The goal is to ensure that the ...

Checking for offline status in a Cordova app using Angular

I have implemented the following code to determine whether my Cordova application is online or offline. var networkState = navigator.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown'; states[Connection.ETHERNET] = ' ...

Angular.js model that is updated by checkboxes

In my project, I have created a model that is linked to several other models. For instance, let's consider a scenario similar to a Stack Overflow question associated with tags. Before making a POST or PUT request, the final Object may appear like this ...

Provide a unique <li> attribute for the JavaScript function to utilize

Is there a way to pass specific attributes from dropdown options to a javascript function? I have tried using .data() and .attr(), but the console keeps showing "undefined". Any suggestions on how to achieve this in a cleaner and simpler way would be gre ...