-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Skewed output when changing resolution of new headless_renderer
example
#13384
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
Comments
The AppConfig struct is where I started, I just decreased the width by one, e.g. on line 68-72: let config = AppConfig {
width: 1919,
height: 1080,
single_image: true,
}; ...which results in the 45° skewed image (second screenshot). I also tried adding 4, 8, 16, and 32 to the width to see if that worked, and it didn't- but just now I tried adding 64 (1952x1080) and it worked! So it seems that the width has to be multiples of 64. It wouldn't be a problem for most fixed resolutions but for my use case a user might resize it to anything. |
If found the root of problem. That is in copying from image to buffer, because copy_texture_to_buffer can copy image only by rows aligned wgpu::COPY_BYTES_PER_ROW_ALIGNMENT. That is why image in buffer can be little bit wider. I will fix copying from buffer to resulting image. |
Oh great! I tried digging but wgpu calls are a bit beyond me at the moment. Thanks for your help! |
@cxreiff Done |
…ensions (#13388) # Objective - Fixes #13384 . ## Solution - If the image became wider when copying from the texture to the buffer, then the data is reduced to its original size when copying from the buffer to the image. ## Testing - Ran example with 1919x1080 resolution  --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: François Mockers <[email protected]>
Bevy version
main
v0.14.0-dev
f91fd32
Relevant system information
rustc/cargo 1.78.0
What you did
Hello all - I am taking a look at the new headless_renderer example in the repo: https://github.com/bevyengine/bevy/blob/main/examples/app/headless_renderer.rs
#13006
I have a use case where I would need to set the dimensions of the output image based on something outside of bevy. So I ran the example after changing the configured dimensions (on line 69 in the AppConfig struct).
What went wrong
I expected the output image to be properly formatted at the indicated resolution. However, just changing the width by 1 or a few results in output that is skewed/misaligned (examples attached).
I sort of suspected that this had to do with bevy's default output, which doesn't match the resolution in the example but does have the same aspect ratio. So I changed the primary_window in WindowPlugin from None to a window with the config-defined dimensions:
...but it didn't change the output at all (and in fact no window appears, I assume because the camera's target is still set to a texture).
Additional information
I assume its most likely some kind of bit alignment issue where the resolution needs to be a certain aspect ratio or along certain increments, but I tried changing the width by increments of 4, 8, etc, and had no luck.
Thank you.
The text was updated successfully, but these errors were encountered: