-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
EffectComposer: Regard pixelRatio in .setSize() #14340
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
Conversation
|
@Mugen87 Cool! |
|
This is nice. However, you are now handling these cases the same. var pixelRatio = renderer.getPixelRatio();
var newWidth = Math.floor( width * pixelRatio ) || 1; // multiply
var newHeight = Math.floor( height * pixelRatio ) || 1;
composer.setSize( newWidth, newHeight );var pixelRatio = renderer.getPixelRatio();
var newWidth = Math.floor( width / pixelRatio ) || 1; // divide
var newHeight = Math.floor( height / pixelRatio ) || 1;
composer.setSize( newWidth, newHeight );So either they were wrong before and you fixed it, or it's wrong now. Do we always want the pass to have the same resolution of the drawing buffer? I vaguely remember there are cases in which the answer is 'no'. Could that be the reason for the difference? |
That just does not make sense to me, so l think what you have here is an improvement.
Let's not worry about that unless there is demand for it. :-) |
|
So why does Should it not auto-size using var size = this.renderer.getDrawingBufferSize();Compare with |
I think you need a way to tell |
|
I probably should have asked why we don't have renderer.setSize( width, height );
composer.setSize( width, height );But it is OK, I guess. Thanks, @Mugen87. |
|
Automatic resizing is actually an interesting feature. It should be considered if |
|
I'm actually open to implement a different approach as long as |


EffectComposeralready uses the size of the drawing buffer and thus the pixel ratio of the renderer when creating its internal render targets and when using.reset(). The problem is that.setSize()does not work with the size of the drawing buffer and just applies the given width and height. On systems withdevicePixelRatiogreater 1, the post processing examples reduce their resolution when a resize is performed.This PR ensures the current pixel ratio is respected when a
EffectComposer.setSize()is used. Besides, the post processing examples now resize in a more consistent way than before.