Perspective Transformation of 2.5D Orthographic Graphics
We updated Retro Commander to allow to render all 2.5D orthographic top-down graphics using a perspective transformation, to make it appear more 3D-like. Enable the "Parallax" option in the game's settings.
The perspective transformation should increase immersion by adding a 3D look and feel. The transformation matrix
has been applied as follows to a 3D-Matrix. dx
represents the intensity of the effect, e.g. 0.001
.
Rendering is orthographic if the value is 0.0
.
// source quad position (4 points)
-1.00f , -1.00f,
+1.00f , -1.00f,
+1.00f , +1.00f,
-1.00f , +1.00f,
// target quad position (4 points)
-1.00f , -1.00f,
+1.00f , -1.00f,
+1.00f + dx, +1.00f,
-1.00f - dx, +1.00f
To counter the effect for objects on the maps, those objects are rendered with the transformation reversed. Otherwise, objects would be leaning towards the inside and make the 3D-effect go away.
// calculate xL & xR based on their position on the screen
xL = ...
xR = ...
// source quad position (4 points)
-1.00f + xL, -1.00f,
+1.00f + xR, -1.00f,
+1.00f , +1.00f,
-1.00f , +1.00f,
// target quad position (4 points)
-1.00f , -1.00f,
+1.00f , -1.00f,
+1.00f , +1.00f,
-1.00f , +1.00f
There are few problem areas doing so.
- The mouse coordinates need to be calculated for the transformation (although doable fairly easily).
- While orthographic graphics are crisp, doing a transformation will make the view slightly more "blurry".
- Does this generally improve the look and feel?
- Undoing the transformation for connected objects such as walls or mountain ranges will introduce ugly offsets and potential gaps.
Reference for Rendering Problems:
Download and test the feature now. The game is available from the following sites.
- Official Site: RetroCommander.com
- PC, Mac, Linux: Steam, itch.io, Epic Games
- Android: Google Play
- iOS: Apple
Reference Video: