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

Screen Space Ambient Occlusion post effect #3266

Merged
merged 7 commits into from
Jun 28, 2021
Merged

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jun 25, 2021

Fixes: #1136
Based on #3092, thank you to @raytranuk for an excellent contribution. This PR in addition to the initial PR exposed few parameters and did few small changes related to parameters. I also make it to work on Webgl1.

The implementation is based on the code in Filament Engine: https://github.com/google/filament

Screenshot 2021-06-25 at 13 16 39

example of using the effect on a camera:

camera.addComponent("script");
camera.script.create("ssao", {
    attributes: {
        radius: 5,
        samples: 16,
        brightness: 0
    }
});


scope.resolve("uSSAOBuffer").setValue(this.targets[0].colorBuffer);

// scope.resolve("uFarPlaneOverEdgeDistance").setValue(cameraFarClip / bilateralThreshold);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this line if not required?

Copy link
Contributor

@willeastcott willeastcott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with various suggestions and comments.

mvaligursky and others added 5 commits June 28, 2021 01:46
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
@mvaligursky mvaligursky merged commit d056579 into master Jun 28, 2021
@mvaligursky mvaligursky deleted the mvaligursky-ssao branch June 28, 2021 11:06
@Maksims
Copy link
Contributor

Maksims commented Jun 28, 2021

Can please the shader code be moved to a separate file? Making it more usable than it is when written within JS?
Editor users don't have the easy ability to copy it.

@mvaligursky
Copy link
Contributor Author

I agree it's not ideal, but it matches the style of all post effects - it's a single file with all shaders inlined.
But definitely something to consider for the future, we have plans for the next generation of post effects (including node graph support and similar).

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 request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post-processed Ambient Occlusion
4 participants