PeterTh / gedosato

The Generic DownSampling Tool
GNU General Public License v3.0
462 stars 166 forks source link

Tales of Symphonia Plug-In: Wrong scissor rectangle #353

Open Kaldaien opened 8 years ago

Kaldaien commented 8 years ago

The Tales of Symphonia plug-in miscalculates the scissor rectangle in screen-space. This is largely because most of the places where the scissor rectangle is used (UI and minimap) are not the same aspect ratio or even resolution as the primary rendertarget.


With the original GeDoSaTo plug-in, you can see the problem if you go into the options menu where you set resolution and then scroll up/down. Text extends beyond the top of the frame where it is not supposed to. This happens in other parts of the game too, such as the minimap, but those are harder to demonstrate.

Corrected math based on GeDoSaTo's plug-in can be found here:

https://github.com/Kaldaien/TSF/blob/master/src/render.cpp#L381-L407

This keeps everything perfectly aligned to the original UI clipping rectangles, nothing spills off the mini-map and text in menus never extends above the top of the window frame.


The general idea is to take the (unmodified) render target's dimensions before the scissor rectangle is applied, and reverse-transform the scissor rectangle's coordinates into NDC-space. With that done, it is possible to transform back into window-space for any arbitrary dimensions without it shifting around.

This would be a pull-request, but I haven't bothered to finish setting up the build requirements for GeDoSaTo.

PeterTh commented 8 years ago

That's annoying. Thanks for making me aware of it.