Mesh clipping during rotation

After creating a model using meshes in three.js, I noticed that some of the meshes clip when I move my camera with OrbitControls. The rendered image shows the issue:

https://i.sstatic.net/gBidu.gif

Researching online, I came across a solution suggesting to set the depthWrite of the material to false. However, implementing this caused all elements to display but broke the 3D effect (as this feature is mainly for overlaying elements in a 2D rendering). Here is the render with depthWrite disabled:

https://i.sstatic.net/7crqF.gif

I have provided a minimal example showcasing the issue: https://codepen.io/theogiraudet/pen/WNZKPXx?editors=0110

Thank you for your assistance!

Answer №1

When utilizing the createElement function, ensure to adopt this particular configuration for material:

  const material = new THREE.MeshBasicMaterial({
    map: generateTexture(url),
    alphaTest: 0.5
  });

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 process for creating a PickByValue data type?

The TypeScript language comes with a built-in Pick type, which is defined as follows: type Pick<T, K extends keyof T> = { [P in K]: T[P]; }; If you were to create a custom PickByValue type, how would you implement it to achieve the following func ...

Combining a variety of animations within a mesh

Can someone help me understand this specific example in Three.js? The link is . I am facing some difficulties with the BlendCharacter.js file. this.load = function ( url, onLoad ) { var scope = this; var loader = new THREE.JSONLoader(); load ...

Issue with navigating history back in Angular 7 using an iframe

I'm currently working on a single-page application using Angular. I encountered an issue where, when the user presses the browser's back button, only the YouTube iframe content updates and not the entire page. This results in having to press the ...

Issues with three.js files: The identifier 'define' cannot be found, 'THREE' property is not recognized in the type, and 'set' property does not exist on an empty object

https://i.sstatic.net/LSy6T.png I recently obtained the three.js file with hopes of utilizing it, but I have encountered some errors within the file. Does anyone have any suggestions on how to troubleshoot and resolve these errors? ...

How can a div be displayed next to another div when it is clicked using angular2?

Is there a way to have another page show up after clicking on a div, like shown in the image below? Before Click: https://i.sstatic.net/qSBbc.png After Click: https://i.sstatic.net/julH4.png ...

Interact with table cells using Angular's mousedown and mouseover events

I am looking to create a feature that highlights table cells when the mouse is pressed and hovered over a cell. Essentially, I want the cell to be highlighted whenever the mouse button is clicked and moved over it. However, in this example, there seems to ...

Zod vow denial: ZodError consistently delivers an empty array

My goal is to validate data received from the backend following a specific TypeScript structure. export interface Booking { locationId: string; bookingId: number; spotId: string; from: string; to: string; status: "pending" | "con ...

Creating a new object instance within its own constructor

While delving into the inner workings of the Prisma ORM source code, I stumbled upon this specific section that caught my attention: export class MigrateDev implements Command { public static new(): MigrateDev { return new MigrateDev() } ... ...

Tips for programmatically appending a property to a JSON response (no access to API settings)

UPDATED (SOLVED): In order to modify the objects, I simply had to return { ...post, companyName: updatedCompanyName } Hopefully this explanation will benefit others who are unfamiliar with mutating a JSON API object before storing it ...

Looking to identify the type of a adorned class in Typescript?

Consider the following scenario: return function IsDefined(object: any, propertyName: string) { .... ] We then go ahead and decorate a property like this: class Test { @IsDefined() p1: String = ""; } Now, when we execute a test inside the ...

Organizing a vast TypeScript project: Comparing Modules and Namespaces

As someone relatively new to TypeScript, I am currently working on a small prototyping framework for WebGl. During my project refactoring, I encountered challenges in organizing my code, debating between using modules or namespaces as both have their drawb ...

I am looking to enhance the dimensions of my shapes by utilizing the ExtrudeGeometry feature in Three.js. Can anyone provide guidance on

I am currently utilizing three.js to create a line in my project. However, I am facing an issue where the line appears flat like a paper, instead of a three-dimensional wall. I am struggling to increase the height of the line in my code. Below is the code ...

Dynamic starting point iteration in javascript

I'm currently working on a logic that involves looping and logging custom starting point indexes based on specific conditions. For instance, if the current index is not 0, the count will increment. Here is a sample array data: const data = [ { ...

Guide to incorporating third-party libraries in Angular

Greetings, I have a common question regarding Angular and utilizing third-party libraries. As someone who does not frequently work with Typescript/Frontends, I am encountering an issue with Angular. Specifically, I am attempting to incorporate the node-htm ...

Creating a dynamic 3D camera view in three.js for navigating around the scene

As a newcomer to Three.js, I am looking to implement a fly-around camera in my scene. I have discovered that THREE.Geometry has a method called .computeBoundingSphere() and a property called .boundingSphere that provides me with the center and radius of t ...

Arrange the collection of objects in a recursive manner

I am facing an issue with sorting a class recursively based on the sortOrder property. Below is the structure of the class: Node { sortOrder: number; children: Node[]; } Although I have attempted to implement a sorting method, it did not work as ...

Unable to pass a parameter through an Angular http.get request

I've encountered an issue where I am attempting to pass the page number and page size values to a web API, but for some reason, no parameters are being passed. I have thoroughly debugged the application in VS Code, and verified that the pagingModel ob ...

Issue: "The specified function type '(num: number) => number' cannot be assigned to type 'number'.(2322)"

Whenever I use a function like this, everything works smoothly: const roundToTwo = (num: number) => { return +(Math.round(+(num + "e+2")) + "e-2"); }; Upon hovering over the function name in VS Code, I can observe that it returns ...

Indicate the location of tsconfig.json file when setting up Cypress

Having trouble integrating Cypress with Typescript? I've encountered an issue where Cypress is unable to locate the tsconfig.json file I created for it. My preference is to organize my project with a custom directory structure, keeping configuration f ...

Angular is patiently waiting for the initial function to activate

I have a situation where I need to wait for the results of my first function before executing the second one. code First function getUser() { this.authService.user().subscribe( user => { this.user = user; console.log('c ...