Code Monkey home page Code Monkey logo

Comments (10)

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

At first I would have guessed it was from using a second material with {wireframe: true} but I can't see this being the case.

from three.js.

mrdoob avatar mrdoob commented on May 5, 2024

Unfortunately there is no way to avoid the diagonal lines appearing when using CanvasRenderer and opacity < 1 materials.

A work around for you would be to fake the transparency in the texture directly. You could achieve this by having 2 canvas. One with the original image, and another one with the fake-transparent (dynamically tinted to white) image. So every time you interact with the picture you update the texture by drawing the 1st one and then applying fillRect() with the amount of white that you need to give the feeling it's "transparent".

Take a look at materials_video.html to see how to update a texture per frame.

from three.js.

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

@mrdoob are the diagonal lines from the triangles overlapping?

from three.js.

mrdoob avatar mrdoob commented on May 5, 2024

Yep. No workaround for that, because canvas antialias (depending of the browser) the shapes. So, either you have gaps or if you overlap the triangles you have visual overlapping when opacity < 1.

from three.js.

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

Do you plan on implementing a depth buffer for the CanvasRenderer?

I think using NOT_EQUAL compositing in conjunction with a depth buffer could alleviate this issue...

from three.js.

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

How exactly are you achieving Z-buffering ATM?

I had a look through CanvasRenderer but I can't seem to find any reference to anything other than DepthMaterial which I imagine is what you're utilising somehow. But I cannot see the compositing code.

from three.js.

mrdoob avatar mrdoob commented on May 5, 2024

CanvasRenderer and SVGRenderer (and DOMRenderer) use Projector(.js) for projecting the 3d scene in 2d (and that's where the sorting gets done).

from three.js.

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

So it's painters algorithm?

That explains why my transparent plane pops in and out of cubes I place on it.

Since you already have DepthMaterial, implementing a depth buffer would be relatively easy. It's definitely something to look into as it will solve multiple issues.

from three.js.

mrdoob avatar mrdoob commented on May 5, 2024

I think this issue has been resolved/question has been answered.

pyrotechnick: I think you're question is unrelated here (I have the feeling you're talking about WebGLRenderer). Feel free to open another issue if it's not. Lets try to be organised and keep conversations on-topic.

from three.js.

525c1e21-bd67-4735-ac99-b4b0e5262290 avatar 525c1e21-bd67-4735-ac99-b4b0e5262290 commented on May 5, 2024

I'm indeed suggesting CanvasRenderer should implement depth buffering. Depth buffering is currently available in WebGLRenderer since it's handled provided by WebGL and implemented in hardware.

My suggestion entirely relates to this issue since what I propose would allow for hiding the diagonal lines currently drawn by CanvasRenderer.

Nevertheless, as mrdoob suggests, let's move this conversation to another issue; with a more appropriate title.

from three.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.