-
Notifications
You must be signed in to change notification settings - Fork 109
fix(view): Adjust default camera height to compensate for screen aspect ratio, reduce camera map limits and increase terrain render distance. #1711
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
base: main
Are you sure you want to change the base?
Conversation
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Outdated
Show resolved
Hide resolved
My goal was to try match the vertical view as close as possible to retail, I think it's slightly less than compared to 4:3 but slightly more than 16:9 gentool + retail. I think it has a reasonable tradeoff considering the extended horizontal view. It also gives a reasonable view for aspect ratios between 4:3 and 1:1 as well. Giving a little more vertical view. Under 1:1 things are still quite broken but a lot needs changing in the view handling to properly support portrait mode. |
|
Yes GenTool did take some vertical view away to compensate for the wider view, perhaps in an attempt to keep conditions fair. Additional camera height does give a competitive advantage. Are we ok with giving advantages to Wide Screen? |
|
I wouldn't consider it an issue since most screens have been wide aspect For the past decade. If anything widescreen is the standard now. Ultrawide is where it becomes more of an issue. But we could look at implementing a locked aspect mode for the tactical view in future. Or another option could be implementing tactical zoom to let people zoom out to view the entire map etc. |
02a64e0 to
57fe78d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple implementation, but man the EA code is confusing.
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
57fe78d to
271ca5b
Compare
|
Tweaked the code so Still need to look at the zoom default handling. |
271ca5b to
f6c96d8
Compare
|
Updated with tweaked max and default zoom handling code. |
f6c96d8 to
c3c7b85
Compare
|
Small tweak to comments |
| updateLoadProgress(LOAD_PROGRESS_POST_PRELOAD_ASSETS); | ||
|
|
||
| // TheSuperHackers @info Initialize the default view to update the max height if the resolution was changed | ||
| TheTacticalView->setDefaultCameraHeight(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps name this function setCameraHeightToDefault to be consistent with the other function names.
Also, the name of the function is misleading. What it really does is setHeightAboveGroundLimitsToDefault().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with setCameraHeightLimitsToDefault() which might suit better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setCameraHeightLimitsToDefault relates to setHeightAboveGround. It would be good if the name is consistent with its counterpart one way or another.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to setCameraHeightAboveGroundLimitsToDefault()
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight * aspectRatioScale * heightScale; | ||
| m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * aspectRatioScale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On map Defcon6 with 16:9 resolution, I can see black top edges when scrolling quickly. These are the edges of the rendered height map (a rectangle). Can you also look into scaling the terrain draw area? I do not yet know how this code works exactly but you can start looking around m_drawEntireTerrain, class WorldHeightMap. When zooming out more, it becomes more obvious (there is a Debug Command to zoom out).
If you do not want to do it in this change, then a follow up is also ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be possible, i think i have seen it in the camera code elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i have implemented a 1.5x scaling factor to the world height map draw area when a wide aspect ratio is used.
This works all the way up to 32:9 aspect ratios with the camera height scaling code.
I used a fixed scaling factor since when using an aspect ratio based scale it would often increase the draw area well beyond the size of the map itself.
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Outdated
Show resolved
Hide resolved
c3c7b85 to
7acc71b
Compare
|
I have updated based on feedback and extended the functionality of this PR to fix some other issues that crop up with the camera. The camera extent limits have now been reduced by half at the edges of the map, allowing the camera to move closer to the edge of the map. This fixes the view at the bottom of the map experienced by quite a few maps. It also extends the rendering distance from the camera of the terrain by 50% if a wide aspect ratio is in use. This works all the way up to 32:9 aspects. Originally i was going to scale based on aspect ratio but it always produced values higher than the fixed scale. |
7acc71b to
c5fbb86
Compare
|
Last one was a quick rebase with main |
c5fbb86 to
52f7de7
Compare
|
Tweaked naming, should be good now |


merge by rebase
This PR adjusts the default max camera height to compensate for different screen aspect ratios.
Previous work fixed the vertical field of view to match retail and adjusted the horizontal fields of view.
But this resulted in significant distortion being observed in the periphery of the view and lower corners.
This distortion was also observed at the 16:9 aspect ratio and became significantly worse as the aspect ratio increased.
By maintaining the original 60 degrees horizontal field of view, while allowing the game to narrow the vertical field of view, increasing the camera height results in minimal to no distortion being observed.
This PR does not fix any other known camera issues and focuses on giving a playable default view.EDIT:
This PR now also fixes the issue with the camera extents, allowing the camera to move closer to the lower edge of the map by half of the original extent limit.
It also increases the terrain render distance for widescreen views.
TODO