pmndrs / postprocessing

A post processing library for three.js.
zlib License
2.32k stars 209 forks source link

Is viewport respected? #386

Closed drone1 closed 7 months ago

drone1 commented 2 years ago

Simple question. I don't see anything about the viewport or examples of it used. My application renders multiple scenes within the same buffer using scissor/viewport. Would love to use this but wanted to ask before I spend any time. Thanks for your time.

vanruesc commented 2 years ago

This is currently not supported, but it can be done with hacks: https://codesandbox.io/s/long-darkness-szcisb?file=/src/App.js I'll look into options to add automatic support for WebGLRenderer.setViewport and WebGLRenderer.setScissor.

drone1 commented 2 years ago

That would be wonderful. Thank you!

On Sat 23. Jul 2022 at 21:39, Raoul v. R. @.***> wrote:

This is currently not supported, but it can be done with hacks: https://codesandbox.io/s/long-darkness-szcisb?file=/src/App.js I'll look into options to add automatic support for WebGLRenderer.setViewport and WebGLRenderer.setScissor.

— Reply to this email directly, view it on GitHub https://github.com/pmndrs/postprocessing/issues/386#issuecomment-1193178339, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQIEPFU6REA4ZO4KLNJNTLVVRDALANCNFSM54DDP7JA . You are receiving this because you authored the thread.Message ID: @.***>

xuchaozou commented 1 year ago

Please take a look again. It is multiple cameras rendering the same scene. The specific description and code are in #507 , thank you

drone1 commented 1 year ago

I'd like to be able to render multiple scenes with multiple cameras, not a single scene. Is it supported? Thank you so much!

On Sun, Jun 25, 2023 at 3:33 AM xuchaozou @.***> wrote:

Please take a look again. It is multiple cameras rendering the same scene. The specific description and code are in #507 https://github.com/pmndrs/postprocessing/issues/507 , thank you

— Reply to this email directly, view it on GitHub https://github.com/pmndrs/postprocessing/issues/386#issuecomment-1605812359, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQIEPGPSNNPE7ITRHUHX4TXM6IM5ANCNFSM54DDP7JA . You are receiving this because you authored the thread.Message ID: @.***>

vanruesc commented 1 year ago

@drone1 You can use multiple RenderPass instances to render multiple scenes. Make sure to set RenderPass.clearPass.enabled = false if you want to render the scenes to the same frame buffer. Depending on your use case, your composition may require saving intermediate render results in textures via CopyPass. Blending textures together can be done with TextureEffect.

jo-chemla commented 7 months ago

Thanks for the demo, I've got the feeling that this scissors/viewport example in the codesandbox could be useful to have a screen which would be split. Eg first left third side of the screen with a given EffectPass applied, center third with another, and right third with again another. This should be less performance hungry than doing full-screen RenderPass with different EffectPasses and combining them - for example via a ShaderPass, right?

Tried forking here with viewport [0,0,w,h] and scissors set to half-width, trying to adding different RenderPasses after the scissorPassA/B but is applies to the whole screen for now.

vanruesc commented 7 months ago

@jo-chemla Proper support for scissor/viewport settings is planned for v7.

Closing this in favor of #570.

jo-chemla commented 7 months ago

Thanks for getting back, I'll follow the scissor/viewport v7 implementation thread - just thought it could be hacked in the meantime with the current v6 codesandbox, but waiting for proper support in v7 is a great alternative.

And thanks for the awesome work on the postprocessing lib!