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

I want anti-aliasing of the outlines. #15

Open
workamiracle opened this issue Feb 25, 2023 · 4 comments
Open

I want anti-aliasing of the outlines. #15

workamiracle opened this issue Feb 25, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@workamiracle
Copy link

I think these outlines are too rough.
Is there anyway to activate anti-aliasing for the outlines?
image

@OmarShehata
Copy link
Owner

You can try to add antialiasing as a post process after the outline shader runs. In ThreeJS there is a built-in FXAA shader, here's an example using it:

const effectFXAA = new ShaderPass(FXAAShader);
effectFXAA.uniforms["resolution"].value.set(
1 / window.innerWidth,
1 / window.innerHeight
);
composer.addPass(effectFXAA);

I think another idea that may produce better results is MSAA? To render it to a bigger offscreen canvas and then scale it down when rendering to the final screen

@workamiracle
Copy link
Author

I am already using FXAA and don't know how to use MSAA. Could you provide some sample codes?

@OmarShehata
Copy link
Owner

I unfortunately do not have a code sample for this. My understanding is you would need to set up the post process to render to a framebuffer that's larger than the screen (maybe 2x as large?) and then scale it down when rendering to the screen, and that may produce better results.

Otherwise, as far as I can tell ThreeJS can do MSAA for you but only when rendering directly to a screen, not a framebuffer like we're doing here for post processing? Not 100% sure.

@OmarShehata OmarShehata added the help wanted Extra attention is needed label Mar 3, 2023
@workamiracle
Copy link
Author

Thank you for your replying.
I have another issue now.
Can I add different outlines in the same scene? Different colors, different opacity, something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants