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

fix(native): use MSAA for antialias on iOS #3139

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

CodyJasonBennett
Copy link
Member

Fixes #3114.

Copy link

codesandbox-ci bot commented Jan 2, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a28f63e:

Sandbox Source
example Configuration

@CodyJasonBennett CodyJasonBennett merged commit b9f8f8a into master Jan 2, 2024
2 checks passed
@CodyJasonBennett CodyJasonBennett deleted the fix/native-ios-antialias branch January 2, 2024 10:26
@ninjz
Copy link

ninjz commented Jan 15, 2024

@CodyJasonBennett I see that this fix only applies to iOS. Is there any way to get MSAA working on Android as well?

I have been using EffectComposer with FXAA however it changes the lighting effects and it doesn't match up to the lighting to iOS with MSAA on.

@CodyJasonBennett
Copy link
Member Author

It should work on Android by default. Otherwise, render to a rendertarget with samples configured.

@ninjz
Copy link

ninjz commented Jan 15, 2024

Yeah, on Android it doesn't seem to be on by default. When trying to set the render target with samples configured I get this error:

Error: Exception in HostFunction: EXGL: renderbufferStorageMultisample() isn't implemented yet!, js engine: hermes

Here is how I am setting the render target:

<Canvas
    camera={cameraRef.current}
    gl={{
        powerPreference: 'high-performance',
        logarithmicDepthBuffer: true,
        antialias: true,
        stencil: false,
        depth: false,
    }}
    scene={sceneRef.current}
    onCreated={state => {
        state.gl.setRenderTarget(
            new THREE.WebGLRenderTarget(deviceWidth, deviceHeight, {
                samples: 1,
            }),
        );
    }}>
   {/* Omitted */}
</Canvas>

Am I missing something here?

@CodyJasonBennett
Copy link
Member Author

CodyJasonBennett commented Jan 15, 2024

I'd continue this in expo-gl if you must have that. IMO I would stick with FXAA or SMAA for mobile unless you're hellbent on alpha-to-coverage.

Please, create a discussion or ask in our Discord for questions like this. I mostly miss stuff in old triage and it's not a good place for back and forth conversation.

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

Successfully merging this pull request may close these issues.

Anti-Aliasing does not seem to work on React Native
2 participants