Viewport rendering incorrectly #16189
Unanswered
liketoeatcheese
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Purpose
I'm trying to set up the viewport in the game so when user's window is set to fullscreen with:
the viewport is actually in the has the ratio of 21:9, where surrounding the viewport will be these black¡¡
Thought process
In my understanding:
And looking at Viewport:
In my head, this means that physical size is the size of the "screen" where the content of the camera will render to. And the position is the position of this viewport in the window. So I would need to get the window size, scale it down, and set it to Viewport's physical size. And half the position of the windows's width and height to make the viewport go in the middle of the screen as the viewport position starts from (0,0) which is the top left corner of the window.
Attempts
Where I spawned the camera on StartUp:
The system
Which I thought that I succeeded
This is a simple dungeon scene.
But when I started to zoom in, I noticed there's this kinda like a filter or some sort:
The size and position of that lighter region don't change regardless of the movement of the camera inside the game world.
I have tried to fiddle with the Viewport and noticed that, if I move the position of the
Viewport
back to(0,0)
. I won't have that white region, as I assumed everything inside the camera will fall into that region.And also did:
And got:
window.width: 2560
window.height: 1080
Noticing how that white region is about 0.8* of a fourth of the screen so I would assume that it's correspond to the
Viewport
's size. And it's proven with changing this piece of code:and got:
So checking my resolution:
It's currently set for 2560x1080. My monitor is actually 5120x2160. So the white region half the screen would probably mean that it can expand more to 5210x2160 right? right?... Not so fast.
I changed the code now to:
I don't really understand this though because based on the original documentation, the right thing would be to scale it down, not scale it up. I tried it even though it didn't make sense and as expected that it will fail, I got:
I have tried reading documentation, various articles, even asked AI. Also tried playing around with the aspect ratio of the Projection but didn't make any difference. I'm running out of options so if anyone can assist me to understand why is this happening it would be great.
Cheers,
W.
Beta Was this translation helpful? Give feedback.
All reactions