question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DoubleSide, transparent material produces artefacts between overlapping front and back faces

See original GitHub issue

Hey Team Three,

Incredible work on the library - I am having an absolute blast on my first WegGL project thanks to you guys : )

However, I am experiencing some rendering artefacts between overlapping front and back faces when setting a MeshBasicMaterial up like so:

map = THREE.ImageUtils.loadTexture('some_transparent_image.png');
material = new THREE.MeshBasicMaterial({
    map: map,
    transparent: true,
    side: THREE.DoubleSide,
    depthTest: false
});

I have created a quick fiddle to demonstrate the issue I am experiencing:

http://jsfiddle.net/92Mb7/19/

Notice that as you slowly roll the sphere/camera up and down along the X axis, artefacts start to appear as ‘bands’ between overlapping front and back faces. This is even more evident when depthTest is set to true. However when depthTest is set to true, these artefacts only appear when looking down on the sphere from the top. Conversely, looking at the sphere from the bottom renders the mesh and material as I would expect.

I have spoken to @aerotwist about this and he has explained that it is likely an issue to do with the depth buffer, but was hoping that it was resolvable?

Any aid you can provide would be greatly appreciated 😄

Many Thanks,

Matt

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
apenduacommented, Oct 2, 2012

@MatthewWagerfield Why not try rendering the model twice? First with side = THREE.BackSide, than with side = THREE.FrontSide. This should do the job for all convex geometries without any need to sort objects / triangles or whatever. BTW, I’ve been always thinking that this particular use-case is the reason to introduce the THREE.BackFace functionality, but now I’m not sure 😉

1reaction
WestLangleycommented, Feb 23, 2019

@Anniks Please redirect your question to the three.js forum.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transparency overlap artifacts with Unlit/Transparency shader
I have an open, textured, 3D mesh that I would like to render with an Unlit shader that allows transparency by adjusting alpha....
Read more >
Moiré pattern - Wikipedia
In mathematics, physics, and art, moiré patterns or moiré fringes are large-scale interference patterns that can be produced ... produced when an opaque...
Read more >
Shader graph, trouble with two sided faces and alpha ...
Efficient and correct sorting of arbitrary transparent geometry is an unsolved problem for real time rendering. Opaque or alpha tested shaders ...
Read more >
Solving A Common WebGL Issue: Transparency - ShapeDiver
In this blog post, I want to talk about a typical problem that most applications using WebGL face at some point: transparency issues....
Read more >
artifacts when rendering both sides of a transparent object ...
You can achieve the look of a double-sided, transparent sphere in ... the triangles would have to be rendered from back to front...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found