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

Refactor depth buffer rendering #2953

Closed
mvaligursky opened this issue Mar 10, 2021 · 7 comments
Closed

Refactor depth buffer rendering #2953

mvaligursky opened this issue Mar 10, 2021 · 7 comments
Assignees
Labels
area: graphics Graphics related issue bug feature performance Relating to load times or frame rate

Comments

@mvaligursky
Copy link
Contributor

mvaligursky commented Mar 10, 2021

@mvaligursky mvaligursky added bug enhancement performance Relating to load times or frame rate area: graphics Graphics related issue labels Mar 10, 2021
@mvaligursky mvaligursky self-assigned this Mar 10, 2021
@Maksims
Copy link
Collaborator

Maksims commented Mar 10, 2021

Not sure in details how it works now, but recently developer had to do this:

  1. Render World Layer into RT.
  2. Do few passes to blur texture into another RT.
  3. Render Glass Layer (with previously blurred texture) from the respecting actual depth of the World Layer, so it occludes correctly.

And I think it was not smooth or difficult to do such thing efficiently, avoiding extra depth pre-pass on Glass Layer, so to avoid unnecessary drawcalls.

@YessicaSD
Copy link

Help!!! I have created SSAO post effect and It works fine in windows but in Mac it triggers the ERROR: FRAMEBUFFER_INCOMPLETE_ATTACHMENT (although it shows the effect)

@mvaligursky
Copy link
Contributor Author

this is our attempt to have good quality SSAO .. #3092

@YessicaSD
Copy link

I've made some changes and it doesn't crush but it seams that the depth buffer is not clearing.
I followed this project's structure -> https://playcanvas.com/project/642131/overview/depthmap-access

@mvaligursky
Copy link
Contributor Author

if you need support, please post on the forum: http://forum.playcanvas.com/
This is to post issues with the engine code for us to work on.

@mvaligursky
Copy link
Contributor Author

I tried to use Webgl1 extension WEBGL_depth_texture when refactoring the depth rendering in #4244, to avoid having to re-render meshes from layers before the Depth layer.
This can be done when the camera is rendering to a render target, as using the extension we can then copy the depth using shader into a texture (similarly as done in the Viewer: https://github.com/playcanvas/model-viewer/blob/main/src/read-depth.ts). The problem is when we're rendering straight into a default framebuffer - I don't see a way to copy out the depth from it, as it cannot be accessed as a texture and used in the shader. Specifically, I tried calling this to obtain the depth attachment (texture)

gl.bindFramebuffer(gl.FRAMEBUFFER, null);
const data = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT,
                            gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);

but it results in
WebGL: INVALID_OPERATION: getFramebufferAttachmentParameter: no framebuffer bound

@mvaligursky
Copy link
Contributor Author

Closing this, as the remaining work was for WebGL1 which is no longer applicable due to WebGL1 support getting removed here: #6666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug feature performance Relating to load times or frame rate
Projects
None yet
Development

No branches or pull requests

4 participants