It seems like the texture may not have been created correctly

My WebGL app for volume ray casting is nearly complete. However, I have encountered an issue with simulating a 3D texture using a 2D texture. Creating a large texture from smaller slices, the dimensions of the huge texture are approximately 4096x4096px. The problem arises when in certain scenarios (depending on the number of slices), there appears to be something like the image below (I filled the huge texture with white to make the fragments more visible).

I understand that the number of stripes depends on the number of rows in the huge texture. While generating this texture close to 4096x4096px (but not exactly), such as 4080x4060 etc., I suspect the issue lies in Three.js loading my texture to the GPU without scaling it to 4096x4096. Consequently, I am seeing black color on the border of the texture in the fragment shader because WebGL only works with square textures (512x512, 1024x1024... etc.), leading to black stripes in the rendered image.

The biggest hurdle is that my Three.js application does not cooperate with WebGL Inspector, leaving me uncertain about whether that is the root cause.

Any suggestions on how to rectify this?

Thanks,

Tomáš

EDIT:

Alright, I've identified the issue and attempted a "solution"...which didn't work effectively. I have two datasets where one is working correctly while the other still presents the same error.

Two variations of code (each functioning well for one dataset but not the other):

First)

 dx = mod(slice, numColsInTexture) / numColsInTexture;
 dy = 1.0 - (floor(slice / numColsInTexture) / numRowsInTexture);

Second)

dx = 1.0 -  (mod(slice, numColsInTexture) / numColsInTexture);
dy = (floor(slice / numColsInTexture) / numRowsInTexture);

I'm unsure why it isn't working for both datasets...I attempted inspecting the GPU (WebGL inspector). Both textures load validly onto the GPU with the same orientation and dimensions. Everything appears identical.

Please assist me....thank you.

Answer №1

Have you ensured that the MIN and MAX filters in your texture are set to NEAREST? Also, have you checked that the WRAP[ST] parameters are correctly set to CLAMP_TO_EDGE?

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

What is the appropriate way to utilize `render_template` from Flask within Angular?

I'm facing an issue where I need to implement different routes for various Angular Material tabs. I have attempted to directly call Flask from the template, as demonstrated below, but unfortunately, I am unable to invoke render_template from Angular. ...

Changing div height based on the height of another dynamic div

Looking to create a box that matches the height of the entire page, live height minus another dynamic div called #wrapping. I have code that offsets it instead of removing the height of the div... function adjustBoxHeight() { var viewPortHeight = $(wind ...

The Three.js environment experiences lag and a decrease in performance

In the threejs scene, there is a sphere geometry and a plane geometry. The sphere is textured with an image, while the plane geometry is textured with 2D text. The plane geometry is also attached with a click event. When clicking on the plane geometry, ...

Is there a way to automatically scroll the parent page's top when the user navigates within an iframe?

We are encountering an issue with the loading of the iFrame. When the iFrame loads on the client's page, we notice that the page location jumps around and, in most cases, the page focus is lower down the page. This requires users to scroll up to view ...

Flot Graphs: A unique dual-axis line chart with the ability to stack data on one axis

Is it possible to utilize the FLOT Javascript library for creating a chart with dual axis and three data sets? I am specifically looking to have one data set on the left axis and two on the right axis. Ideally, I want to stack the two datasets on the right ...

selenium tutorial: Testing tooltip functionality with Python

<div class="icon_png information icon_baggageyes" title="getTooltip()"></div> Here, a tooltip is displayed using the getTooltip() function. Is there a method to retrieve the return value of the function for testing with Selenium? ...

I wonder, who is the one executing the function?

In my application, I have encountered an unusual issue. Within my controller, I have two functions - one to add a tab, and one to remove a tab. Below is the code snippet: $scope.createTab = function(){ $scope.addTab("New Tab",50,0); co ...

Retrieving the return value from an AJAX call in C# using asynchronous methods

When it comes to retrieving a value using Ajax on the client side, I rely on this JQuery function: $.ajax({ type: "POST", url: "/my-page.aspx/checkout", contentType: "application/json; charset=utf-8", dataType: "json", success: functio ...

Tips for transferring an element from different components to a designated component in React.js

In my project, I have a <Header> component and another component called <AboutMe>. My goal is to select an element by its ID from the <AboutMe> component and attach an event listener for onClick. However, whenever I attempt to use getEl ...

The error message states that the provided callback is not a valid function -

I seem to be encountering an issue with the code snippet below, which is part of a wrapper for the Pipl api: The main function here performs a get request and then retrieves information from the API Any assistance in resolving this error would be greatly ...

The function is not explicitly declared within the instance, yet it is being cited during the rendering process in a .vue

import PageNav from '@/components/PageNav.vue'; import PageFooter from '@/components/PageFooter.vue'; export default { name: 'Groups', components: { PageNav, PageFooter, }, data() { return { groups: ...

Error: Cannot register TypeSys.UI._Timer because it has already been registered in Microsoft JScript runtime

Every time I load the page, I encounter this error message. Any idea what could be causing it? I keep receiving the following error: Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered. Any insig ...

Extracting Vertices, Edges, Faces, and Triangles from GLB Model Using ThreeJS GLTFLoader

I am looking to incorporate basic information about the model into my model viewer. Specifically, I need to obtain the vertex, edge, face, and triangle count of the object, or at the very least, the vertex count. My attempted approach involves using the f ...

Using jQuery to manage multiple page requests on a single page

In my current project using Codeigniter, I encountered a challenge of loading multiple paginations on one page. After exploring various forums and websites, I decided to implement multiple methods and views to achieve this using jQuery. The code snippet I ...

Creating responsive arrow heads using D3: A step-by-step guide

Currently, I am working on creating a thermometer-style bar chart using D3.js version 3. While I have successfully created a basic responsive rectangle with two filled colors, I am facing difficulties in figuring out how to add arrow heads to the design. B ...

Understanding the mechanisms of Promise functionality within Typescript can be challenging, particularly when encountering error messages such as "type void is not

Recently, I've delved into the world of Typescript. Despite my efforts to stay true to the typing system, I've encountered a challenge that forces me to resort to using the any type: The issue arises with a function that returns a promise: sav ...

Is it possible to create a unit test for a JavaScript function that manipulates an HTML element?

I'm struggling with testing a function that includes a modal displayer like this: function modaldisplayer(){ $('.mymodal').modal('show'); return 'success'; } In my code, there is another function called 'foo&a ...

Issue with Google map displaying incorrectly when attempting to print

I am experiencing an issue with printing a Google Map using the JavaScript API V3. The problem I am facing is that the map is split into two parts, with the top and bottom sections overlapping each other. Here is the code snippet: var geocoder; var ...

d3: It appears that my routes are replicating themselves, and I am unable to ascertain the cause

I've been diving deep into D3, studying the works of Mike Bostock and other experts in the field. I'm also going through Scott Murray's book on Interactive Data Visualization specifically focusing on D3. At the moment, my project involves c ...

Tips for incorporating nonce or sha into the connect-src directive in Content Security Policy (CSP)

Can a nonce be used in an API request to make sure that the connect-src in CSP doesn't flag it as a malicious address? It appears that nonce can only be used in script-src or style-src, not in connect-src. So far, I have only been able to list URLs ...