Exploring creative art with Three.js streaming

I'm seeking advice on the best way to handle a large amount of data from a stream in Three.js, without needing to store it in memory for the entire application's lifespan.

In traditional WebGL, this is typically achieved with gl_drawArray. However, I'm unsure which object in Three.js corresponds to this functionality.

While using ParticleSystem objects, data must be stored in memory as all points need to be placed within a Geometry node before being passed to the ParticleSystem; making this method unsuitable for my needs.

Any guidance you can provide would be greatly appreciated.


Edit: To clarify, I am trying to render millions of x,y,z coordinates as individual dots in 3D space. Currently, my process involves:

var geometry = new THREE.Geometry();

while( hasMoreData ){
    var vertex = new THREE.Vector3(x,y,z);
    geometry.vertices.push(vertex);
}
sphere = new THREE.ParticleSystem(geometry, shaderMaterial);
scene.add(sphere);

However, this approach significantly increases memory consumption, by around 1GB, due to the data persisting in the building of the geometry object. Is there a way to read this data from a file without it remaining in memory?

Answer №1

If no more responses are received on this thread, I have come up with a solution that involves utilizing THREE.BufferGeometry instead of THREE.Geometry. This allows for the GPU memory to be used efficiently, resulting in around 300MB of extra memory being utilized by the GPU rather than the 1GB consumed by RAM.

I am open to any other suggestions or insights, as using this method does have an impact on GPU performance compared to alternative approaches.

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

Enhancing Transparency of WMS Layers in OpenLayers

I need help figuring out how to add transparency to a WMS layer in openlayers. Here is the current javascript code for a non-transparent layer: var lyr_GDPSETAAirtemperatureC = new ol.layer.Tile({ source: new ol.source.TileWMS(({ ...

Choose Select2 to remove all selected options

I'm looking for a way to remove all selected values in one click without having to specify each individual 'id' separately. I've tried experimenting with different approaches, but so far, I've only been able to deselect the first ...

Set default date input in Ionic to be today's date

I'm currently developing a project using Ionic framework and I need to set a default date (which is today's date) on an input field. My code works perfectly when the input type is set to text, but it doesn't work if I specify the type as da ...

Accessing a file's source using the Box.net API and downloading the file contents

Recently, I've been busy working on a Web Application project (for fun) that focuses on editing files stored in the cloud. I'm utilizing the box.net API for this task, but I've come across a challenge - obtaining the source code of files. Un ...

Tips for identifying, initiating, and linking to the mobile version of Metamask through a button click on a web application, similar to the process on OpenSea

I recently integrated a shortcode into my project that leverages the Metamask browser extension to display the user's account using a combination of web3 and reactjs. The code functions flawlessly on desktop browsers, but encounters an issue when atte ...

Integrate the element offset into jQuery's offset calculations

I'm new to utilizing jQuery and currently facing a challenge in determining the correct offset for a specific div element within the body. My goal is to make this particular div stick to its position as I scroll down past its designated top offset. A ...

The functionality of Angular Views is experiencing issues

I'm confused as to why the JavaScript isn't functioning properly. Whenever I click on the links, the views fail to load. <html ng-app> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/a ...

Custom control unable to display MP3 file

Hey, I came across this awesome button that I am really interested in using: https://css-tricks.com/making-pure-css-playpause-button/ I'm currently facing two issues with it. First, I can't seem to play the sound. I've placed the mp3 file ...

Instructions for using arrow keys to navigate between div elementsHow to use arrow keys for navigating through

Is it possible to navigate between div elements using arrow keys like in Notion's editor? <div> hello word </div> <div>hi</div> <div>notion</div> Given the code above, how can one move the cursor to another ...

Is it possible to trigger the Facebook Pixel Code using the <noscript> element through programming?

Is there a way to programmatically call the Facebook Pixel Code using noscript? I am facing an issue with the Facebook Pixel Helper extension breaking when the script and noscript code are separated. Can a function be wrapped around the code or built in th ...

Encountering difficulties in the installation of a package within Next JS

Can anyone assist me with this issue I'm facing while trying to install styled-components on Next JS? I keep getting an error after entering npm install --save styled-components: npm ERR! Unexpected end of JSON input while parsing near '...ry.np ...

Having trouble submitting ajax form data through nodemailer

Hey there, Recently, I created a web app using node.js and express. Everything seems to be working fine except for one issue - I am struggling to get the JSON data sent by AJAX into Nodemailer. Despite confirming that my AJAX is successfully sending the ...

What could be causing my Javascript clock to malfunction?

I am having an issue with my clock code, which is supposed to display the date and time set 2 weeks in advance. Unfortunately, it is not working on either local or server environments. Can anyone help me troubleshoot this problem? Here is the code that I ...

Tips for updating a value within ng-repeat only if the value is equal to "string"; otherwise, hide it from display

I'm having trouble updating the data in my table to display "Yup" or blank space based on certain conditions. I am new to this and tried a solution, but it's not working: {{ person.value ? "Yup":" "}} .. Can anyone help me with this? angular.m ...

Removing outline from a Material UI button can be done using a breakpoint

Is there a way to remove the outlined variant for small, medium, and down breakpoints? I have attempted the following approach: const selectedVariant = theme.breakpoints.down('md') ? '' : 'outlined'; <Button name="buy ...

What is the best way to create a continuous typewriter effect in Next.js?

I have a unique project that features a typewriter effect, but I'm encountering an issue where it only types the text once. What I really want is for the typewriter effect to continuously loop, starting over and typing out the words again. I've b ...

Monitor the x and y positions for platformer game interactions using only JavaScript and jQuery

I am currently working on a 2D platformer game as part of my college project alongside my friends. We are using jQuery and pure JS for development. So far, we have been able to move the character left and right using jQuery's animate function, and ena ...

Oops! The Vue star rating encountered an error because it couldn't read the length property of an undefined value at line 26 of listToStyles.js

Encountering an issue with the getRating function in Vue while using the Vue-star-rating package in Laravel. Unsure of what the problem may be. getRating(){ var pathArray = location.pathname.split('/'); v ...

Sharing data from JavaScript to view in Rails: A step-by-step guide

After clicking the submit button, the controller renders with JSON data. The JSON data is {notes: array[1], array[2]}. The next step is to render the view.html.erb file. How can the values in notes be displayed like <%= notes %> in this file? ...

Yii2 pjax not refreshing properly when updating records in the gridview

I have successfully implemented functionality in my grid-view to control the number of rows displayed per page. This feature includes a drop-down menu with options such as 5, 10, 25, 50, and 100 rows. Whenever a user selects an option from the drop-down, I ...