The Art of Receiving Feedback in THREE.js

I have created a feedback loop using backbuffer in my code with the following implementation:

function render()   
{ 
    renderer.setRenderTarget(BufferA);       
    renderer.render(BufferAScene, camera);
    renderer.setRenderTarget(null); 
    renderer.clear(); let temp = BufferA; 
    BufferA = BufferAFeedBack; 
    BufferAFeedBack = temp; 
    ...
 }

While this setup is functional, it triggers a warning about a feedback loop between the texture target and the framebuffer. I suspect this might be affecting shader visibility on mobile devices. I'm wondering if there's a more efficient way to swap FBOs in THREE.js? I have experience with OpenGL and have successfully implemented a similar feature before, so theoretically I could recreate the app using plain WebGL. However, starting from scratch seems like a daunting task! It appears that the abstraction layer is causing unnecessary object duplication compared to plain WebGL. Do you have any suggestions or recommendations?

Answer №1

After taking some advice from gman, I made a few tweaks and now it's working flawlessly:

function updateView()
{

    BufferAUniforms.iChannel0.value = BufferAFeedBack.texture;
    ImageUniforms.iChannel0.value = BufferA.texture;

    renderer.setRenderTarget(BufferA);
    renderer.render(BufferAScene, camera);

    renderer.setRenderTarget(null);
    renderer.clear();

    let temp = BufferA;
    BufferA = BufferAFeedBack;
    BufferAFeedBack = temp;

    renderer.render(BufferImageScene, camera);

}

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

When working with ES6 modules, the value of `this` and $(this) can be undefined

I attempted to integrate the toggleImage functionality into a gallery and referenced this thread along with the code provided in one of the responses. However, upon doing so, I encountered the error message Uncaught TypeError: Cannot read property 'at ...

The JSON file containing API data is stored within the _next folder, making it easily accessible to anyone without the need for security measures or a login in the Next

When accessing the protected user Listing page, we utilize SSR to call the api and retrieve all user records which are then rendered. However, if one were to check the Network tab in Chrome or Firefox, a JSON file containing all user data is generated and ...

Issues with HTML Units not Showing up

I'm trying to achieve the same functionality as this JSFiddle: https://jsfiddle.net/nstruth/t0dopzav/1/ When I select Volvo, the HTML displays correctly but the JavaScript doesn't seem to be functioning. I've looked at other innerHTML JavaS ...

How to implement a modal popup in Vue.js using an anchor tag

As a newcomer to Vue.js, I'm facing an issue with creating a link in my navbar component that, when clicked, displays a modal component. I've noticed that the solutions I found are for buttons which use the data target attribute, but this isn&apo ...

Utilize the precise Kendo chart library files rather than relying on the kendo.all.min.js file

My application currently uses the Kendo chart, and for this purpose, it utilizes the "kendo.all.min.js" file which is quite large at 2.5 MB. To optimize the speed performance of the application, I decided to only include specific Kendo chart libraries. In ...

Using AngularJS ng-if to dynamically show header content according to the current route

Having trouble with my Single Page Application (SPA) where the header needs to change based on the user's route location. The code I've written seems correct, but I keep getting an error: TypeError: undefined is not a function Here's what t ...

Is it possible to increment an integer value in jQuery after obtaining the sum result?

Actually, I'm trying to extract the integer value from my input field. For example, if I enter the value 4+5, I want to display the result as 9 in a separate div. However, instead of getting the expected result, I am receiving [object Object]. I&apo ...

Tips on retrieving and sending an XML string in PHP to JavaScript using MySQL

Here is the code snippet I have: <input type='button' value='clickme' onclick='download(\"\" . $rowtable['Protocolo'] . \".xml\", \"\" . $rowtable['XML&a ...

Only displaying the VUE slot when the content meets a certain criteria

I have encountered a situation where I have two routes rendering the same component but with different data from an API source. The component in question has a child component called <base-section> that utilizes a v-if directive to determine whether ...

What is the best way to send the input text to the filter component in my React application?

I am currently working on developing an application utilizing the "Rick and Morty API" to display a list of characters with various attributes such as gender, alive status, images, etc. My main goal is to implement a search bar that allows users to search ...

Experiencing a problem with Datatables where all columns are being grouped together in a single row

After creating a table with one row using colspan and adding my data to the next row, I encountered an issue with the datatables library. An error message appeared in the console: Uncaught TypeError: Cannot set property '_DT_CellIndex' of unde ...

Secondary camera in THREE.js rotates in sync with head rotation in virtual reality

Combining THREE.js and Aframe (in Exokit) has led me to develop a unique "selfie camera" component. However, I've encountered an unusual issue where the camera rotation is affected by head rotation when entering VR mode. Although I am aware of the cha ...

Is your sticky sidebar getting in the way of your footer?

I've developed a custom sticky sidebar for displaying ads, but I'm facing an issue. When I scroll to the bottom of the page, it overlaps with the footer. Can someone please take a look at this? - var stickySidebar = $('.sticky'); if ...

The model I exported from Clara.io is not showing up on the Three.JS canvas, only a black square is

I recently started using Three.JS and imported an object I exported as a JSON from clara.io. Unfortunately, the object is not appearing in the canvas, instead I see a black square with the dimensions I specified in the variable (400 by 300 pixels). Below ...

Using jQuery to delay hiding for 2 seconds

Hey there! I'm facing an issue with my code. The function is supposed to make #aboutPopOut slide to the left, and then after a 2-second delay, fade out the fadescreen by hiding it. The sliding part works fine, but the waiting and hiding do not seem to ...

Ways to create a minimatch glob that selects every js file except those within a specific folder

I am currently facing a situation where I require a single glob pattern, utilizing minimatch, to match all JavaScript files except those in a specific directory. Unfortunately, the tool I am using does not offer any options such as an ignore glob, so a sin ...

"ModuleNotFound" error occurred when attempting to utilize Netlify lambda functions with external dependencies

https://i.stack.imgur.com/vVmky.jpg I'm currently exploring the capabilities of Netlify, specifically its lambda function feature for running a node function with dependencies. Following a tutorial from CSS-Tricks, my functions/submission-created.js ...

If I click on the datalist link option during an ajax append, I would like to be redirected

When I try to link after clicking an option in the appended AJAX, it does not seem to work as expected: More details: $('#input-friends').on('input', function () { var id = $('#input-friends').val(); $.ajax({ ...

The Null object within localStorage is identified as a String data type

As someone transitioning from Java development to Javascript, I am seeking clarification on a particular issue. In my project, I am utilizing localStorage to keep track of the user's token in the browser. localStorage.token = 'xxx' When a ...

What is the process for refreshing Textures in ThreeJs?

How can I refresh my skybox textures by selecting thumbnails? You can check out this example for reference: canvas_geometry_panorama.html Each thumbnail title corresponds to a folder that contains the skybox images. By using a simple jQuery script, a ...