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

DOF improvements #7211

Open
2 of 9 tasks
mvaligursky opened this issue Dec 18, 2024 · 1 comment
Open
2 of 9 tasks

DOF improvements #7211

mvaligursky opened this issue Dec 18, 2024 · 1 comment
Assignees
Labels
area: graphics Graphics related issue feature performance Relating to load times or frame rate

Comments

@mvaligursky
Copy link
Contributor

mvaligursky commented Dec 18, 2024

Possible improvements for DOF implementation here

Features:

  • WebGPU support. There is compilation issue with one shader currently due to glslang adding no longer supported keyword to the WGSL shader. The solution is to write a version of the shader directly in WGSL. DOF support for WebGPU #7218
  • update CameraFrame script to expose this functionality to the Editor
  • physically based bloom, where instead of distance and range parameters, the bloom is controlled by camera parameters: aperture, fov)
  • blur green channel of CoC texture to allow near blur objects to have soft edges

Performance / quality:

  • make the near blur optional, for experiences where only the background needs to be blurred DOF - near blur is optional #7220
  • when only a small amount of blur is used (less than about 3), it's more obvious the half res scene texture is used as a blur source. We could use high res at that point at a higher cost.
  • use compute shaders as described in links from the original PR to generate tile min/max CoC textures and dispatch more appropriate (cheaper) blur shaders for individual tiles.
  • when TAA is used at the same time, the blurred background flickers due to TAA jitter. We could try to influence TAA's strength based on CoC texture - limit TAA in the more blurry regions. Can be slight perf win as well.
  • consider generation of few (2-3) mip levels of the scene texture (currently have half res only), and optimize the sampling algorithm to use lower mips for wider blurs, with less samples.
@mvaligursky mvaligursky added feature performance Relating to load times or frame rate area: graphics Graphics related issue labels Dec 18, 2024
@mvaligursky mvaligursky self-assigned this Dec 18, 2024
@mvaligursky
Copy link
Contributor Author

suggestion by @Maksims : consider using radial distance from the camera instead of planar, to avoid DOF changing when camera rotates.
This can easily be done in RenderPassCoC, where depth buffer gets converted to near and far CoC values - we could reconstruct view position of the fragment with inverse projection matrix, get the distance if camera to view position vector and using this. We'd need to first convert the linear depth to non-linear depth, but I have that code already, used by TAA.

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

No branches or pull requests

1 participant