Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some kind of a depth buffer regression from 114 #19302

Closed
6 of 14 tasks
pailhead opened this issue May 5, 2020 · 6 comments
Closed
6 of 14 tasks

Some kind of a depth buffer regression from 114 #19302

pailhead opened this issue May 5, 2020 · 6 comments

Comments

@pailhead
Copy link
Contributor

pailhead commented May 5, 2020

Description of the problem

I've submitted a depth peel example a while back: #15312
This example depends on this proposal #15490

So i'm not sure if this counts as a regression since i don't have a meaningful case without using this proposal, but i'd like to point it out regardless, and inquire about what work happened in this area.

This demo runs on r98 and the proposal and everything runs fine. Up to r113 i can apply this diff and get the same behavior:

R113:
peel113

When bumping to R114, the framerate remains, but i get some depth artifacts:
peel114

In the dev branch, my frame rate drops tremendously, and i've oddly traced it down to an ordinary render call that happens after all this crazy depth peeling logic, and before the results are shown on the screen. I can actually even render the results with no frame drop, its just when i try to render a partial normal scene in the process, it really goes down.

image

Ie. this is caused by

function complexRenderLogic (){
  // gl stencil stuff
  // gl mask stuff
  // scene overrides
  // many renderer.render( X, Y )
  // many renderer.setRenderTarget( foo )
}

function displayResult(){
  renderer.render( full_screen_quad_scene, camera)
}

function render(){
  complexRenderLogic()
  renderer.render( scene, camera ) // <----- FRAME RATE DROP`
  displayResult()
}

Please let me know if additional information is needed. I could serve the demo with r113, r114 and dev. If this is of no interest since it's appearing in something thats using a proposal, i'd appreciate it if you could point me in some direction where some recent changes could have affected this. Thank you.

Three.js version
  • Dev
  • r116
  • r115
  • r114
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
@pailhead
Copy link
Contributor Author

pailhead commented May 5, 2020

The specles are caused by unpackRGBAtoDepth with something like:

float prevDepth = unpackRGBAToDepth(texture2D(uPrevDepthTexture,screenPos));
if(prevDepth + uDepthOffset - gl_FragCoord.z >= 0. ){
     discard;
}

Where uDepthOffset can be 0.0 up to r113, but then starts to cause specles. Adding a small value there seems to fix it, but then causes other kinds of issues.

@mrdoob
Copy link
Owner

mrdoob commented May 6, 2020

Would be great if you could isolate what commit in r114 broke your example.

@WestLangley
Copy link
Collaborator

A reasonable guess is #18696.

@pailhead
Copy link
Contributor Author

pailhead commented May 6, 2020

Yes, this seems like the culprit. #18696 has some super useful information.

@WestLangley any ideas about these stalling calls? I've never encountered them before. I'll try to pin this down a bit more, it happened in R115 or R116 or dev and try to open a new issue.

@pailhead pailhead closed this as completed May 6, 2020
@WestLangley
Copy link
Collaborator

I expect you should avoid saving depth to a texture having a lower precision -- if that is, in fact, what you are doing.

@pailhead
Copy link
Contributor Author

pailhead commented May 6, 2020

Sorry, i'm realizing now that this is completely unrelated to the depth stuff. The issue i was having was due to the PR you linked (thanks!). This other issue is in a different version, ill investigate better and open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants