Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/effect-composer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The `EffectComposer` must wrap all your effects. It will manage them for you.
autoClear?: boolean
/** Whether the last pass automatically renders to the screen. Set to `false` when rendering to a target of your own (e.g. via a trailing CopyPass) instead. */
autoRenderToScreen?: boolean
/** MSAA sample count, default 4. Set to 0 to disable it, e.g. when using SMAA or FXAA instead. */
multisampling?: number
frameBufferType?: TextureDataType
/** For effects that support DepthDownsamplingPass */
Expand Down
2 changes: 1 addition & 1 deletion src/EffectComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const EffectComposer = /* @__PURE__ */ memo(function EffectComposer({
depthBuffer,
enableNormalPass,
stencilBuffer,
multisampling = 8,
multisampling = 4,
frameBufferType = HalfFloatType,
renderPass = defaultRenderPass,
mergeMode = 'auto',
Expand Down
28 changes: 28 additions & 0 deletions src/tests/EffectComposer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1529,4 +1529,32 @@ describe('EffectComposer', () => {
expect(composer.outputBuffer.width).toBe(cssSize.width)
})
})

describe('defaults', () => {
it('uses 4 MSAA samples unless multisampling is set', async () => {
const ref = React.createRef<EffectComposerImpl>()

await React.act(async () =>
root.render(
<EffectComposer ref={ref}>
<WrappedEffectA />
</EffectComposer>
)
)
const composer = await waitForComposer(ref)
expect(composer.multisampling).toBe(4)

await React.act(async () =>
root.render(
<EffectComposer ref={ref} multisampling={0}>
<WrappedEffectA />
</EffectComposer>
)
)
const next = await waitForNewComposer(ref, composer)
expect(next.multisampling).toBe(0)

await React.act(async () => root.render(null))
})
})
})
Loading