Skip to content

EffectComposer: Add option for custom render pass #336

Description

@shotamatsuda

I've been trying MRT with EffectComposer in order to avoid additional render passes to output normals, masks, and so on. Extensibility is always a problem with pure components, but in this case, having a RenderPass prop in EffectComposer to accept a class implementing the same interface as RenderPass would allow us to use a custom render pass. Otherwise, and this is my current workaround, we must maintain a modified copy of EffectComposer, which is suboptimal in terms of maintainability.

Like:

export const EffectComposer = memo(
  forwardRef<EffectComposerImpl, EffectComposerProps>(
    (
      {
        ...,
        RenderPass = RenderPass
      },
      ref
    ) => {
      ...
      const [composer, normalPass, downSamplingPass] = useMemo(() => {
        ...
        // Add render pass
        effectComposer.addPass(new RenderPass(scene, camera))
        ...
      }, [
        ...,
        RenderPass
      ])
      ...
    }
  )
)

I'd like to hear your opinion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions