Skip to content

Display and projection

Logical and target pixels

The engine and the port's draw code work in the PS2's 512 x 448 picture: projections (ZCameraViewEntry::CalcCameraToView), camera viewports and scissors, sprites, fills and the GS screen coordinates around 2048 are all in these logical pixels, and GPU_TARGET_WIDTH and GPU_TARGET_HEIGHT keep naming them. g_pSysInterface->m_lResolution stays 512 x 448, so the menus, the OSD and the mouse cursor lay out as on the PS2.

The render targets (frame, temp, copy and depth in gpusdl.cpp, and the post-filter textures) are a separate, physical size described by GpuView():

Field Meaning
fLeft, fWidth The logical range the target covers: fWidth = 512 × fDisplayAspect / (4/3) and fLeft = (512 − fWidth) / 2. At 16:9 these are 682.7 and −85.3 respectively.
lWidth, lHeight Physical target dimensions. The fitted window height is multiplied by the render scale (1–4 on desktop), with a minimum base height of 448 on desktop and a target height cap of 8192. Width is the rounded target height times the display aspect.
fScaleX, fScaleY Target pixels per logical pixel.
fDisplayAspect Window pixel width divided by height, clamped to 0.5–4. Wide mode starts above 1.45.

Clip space joins the two. GpuScreenToClip maps logical pixels, offset by an origin, onto the whole target, so geometry is independent of the target's size. Only the things that work in target pixels convert: GPU scissors (GpuScissorRect), texture copies and readbacks, the post-filter texture sizes and the water shader's SV_Position scale (ScreenScale.xy). The post-filter passes already use normalised positions and UVs. Their blur steps stay in logical half-texels, so a blur has the same width on screen at any scale. DrawPixelToClip is kept for whole-target passes (shadow merge).

Projection aspect

The game projects with a horizontal field of view. ZCAMERA::SetCam6ClipPlanes (PS2 0x1788cc, PC 0x4e3830, the same code on both) takes the camera's FOV across the viewport's width and makes the vertical extent XYAspect = height × PixelAspectXY / width of it. Only the renderer's PixelAspectXY differs between the builds:

Build PixelAspectXY Picture Vertical extent (tan of the half angle, over the horizontal one)
PS2, NTSC (ZRenderPS2::PixelAspectXY, 0x291508) 512 / 448 × 0.75 = 0.857 512 × 448, 4:3 on the television 0.75
PS2, 480p (512 + 96) / 448 × 0.75 = 1.018 512 × 448 in a 480-line progressive signal 0.891
PS2, PAL 512 / (480 + 32) × 0.93458 × 0.75 = 0.701 512 × 480 on a 576-line television, so a picture about 1.6:1 with bars above and below 0.657
PC (ZRender::PixelAspectXY, slot 50, PC 0x468d10) 1.0. ZRenderWintelD3D's video setup (PC 0x48b090) reads the option PixelAspect and then overwrites it with 1.0. the window's own pixels the window's height over its width: 0.75 at 1024 × 768
The port (ZRenderSDL::PixelAspectXY) 512 / 448 × 0.75 = 0.857, in both versions 512 × 448 shown at 4:3 0.75

The PC builds its Direct3D projection in FUN_00488d10 (PC 0x488d10, called by the D3D draw code at 0x4aeca0, 0x4b7710, 0x4b8290, 0x4b8a50 and 0x4b8f80): proj[0] = 1 / tan(FOV / 2) and proj[5] = 1 / (tan(FOV / 2) × (sy / sx) × ((sx / sy) / (viewport w / h)) × ViewAspect × PixelAspectXY), where sx, sy are the render's GetSizeX/GetSizeY (vtable 0xb8, 0xbc), the viewport is the view's (created at the render's size by ZHM3CameraClass::InitializeView, PC 0x5e1230, as on the PS2) and ViewAspect is the camera's (ZCameraSpace +0x128, 1 for the full view). For a full view this is the horizontal FOV across the window and square pixels, whatever the window's shape. Its only other difference is a near plane of at least 5 in the projection.

So at 4:3 the port's projection is the PC's and the PS2's NTSC one: square pixels, the same horizontal FOV (M00's third-person camera: 1.17635 rad, 67.4°; first person 67.5° on all three) and the same vertical extent. Nothing was changed for the PC version.

The PS2 version keeps this framing. It is exactly what ZRenderPS2::PixelAspectXY returns in NTSC mode, the PS2's 60 Hz mode, which the European disc offers in its boot menu (VMODE = PAL in SYSTEM.CNF only chooses the default) and which fills a 4:3 television. The PAL mode's framing belongs to its 480-line buffer on a 576-line television: the same width, 12 % less height, and bars above and below. Reproducing it in a 4:3 window would mean showing those bars too, and the port draws the 448-line buffer of the NTSC mode.

Measured. At M00's start (1024 × 768 window, frame 2,000 of the capture recipe in pc-data.md), an edge-profile fit of the hotel band between the real PC game's view and the port's PC version gives a horizontal scale of 1.0025 with a 1-pixel shift and a vertical scale of 1.010 with a 1-pixel shift, and the disc gives the same horizontal fit as the PC data (scale 1.0, shift 0). The camera log of the port showed the same pose from the disc and from the PC data: position (4538.2, −235.1, 2319.7) and the third row of its rotation (−0.1615, 0, 0.9869), logged from ZOldViewBase::UpdateCamera every 200 frames. The earlier finding that the port's picture was 7 % wider and turned about 120 pixels away came from a capture whose camera had turned between frames 1,600 and 1,800 (PC data: Compared with the real PC game). The 16:9 capture of the same view still draws the wider 16:9 picture with the 4:3 height. All 13 missions ran 2,000 frames and exited 0 on this build (version=pc from the PC installation alone, and version=ps2 from the disc), on 25 November 2026.

Widescreen differs on the PC. With a wide window the PC keeps the horizontal FOV and shows less height (vertical extent = window height / width: 0.5625 at 16:9), so its 16:9 picture is the 4:3 one with the top and bottom cut off. The port's widescreen keeps the height and adds width (Hor+, below), in both versions, because the cameras, the scopes and the HUD were laid out for the 4:3 height. The PC also widens the side clip planes by 4/3 (_DAT_00768a34) when its render's widescreen flag (+0x2b9, set through vtable slot 3, PC 0x468580) is on, as the PS2 code does; no caller that sets that flag was found in the PC code.

Widescreen

In a wide window, the port keeps the vertical field of view and shows more of the scene at the sides.

  • The 3D projection does not change. GpuScreenToClip maps the logical range fLeft to fLeft + fWidth onto the target, so geometry that projects beyond the 4:3 edges lands in the extra width.
  • Culling follows the game's own widescreen mode. ZRenderSDL::Init sets ZRender::m_bWideScreen, and ZCAMERA::SetCam6ClipPlanes then widens the camera's side planes by 4/3 (the 16:9 over 4:3 ratio), so objects in the extra width are not culled. On a screen wider than 16:9 (20:9 phones and handhelds, 21:9 monitors) that left the outer strips culled, so scenery there vanished; the port's ZOldViewBase::UpdateCamera (viewoverridesdl.cpp) turns the side planes, and the camera's portal, out to the screen's own width (WideCullFactor: the display aspect over 4:3). The same flag makes the letterbox cameras (ZCAMERA::SetAspect, the dialog camera in hm3camera.cpp) use their 16:9 borders. The PS2 game never sets this flag itself.
  • ZRenderSDL::PixelAspectXY always returns the 4:3 pixel shape. With the flag set it used to return the anamorphic 16:9 value, which would squeeze the picture into 512 pixels for a widescreen TV.
  • 2D stays in the centre 4:3, with the PS2's positions. In widescreen, GpuWidenScreenEdges moves an edge at a border of the 4:3 picture to the border of the wider one. That widens camera clears, letterbox bars, full-screen fills and scissors, the fade overlays and the post-filter screen quads. Untextured sprites that cover the whole 4:3 picture (fades, dimmed backgrounds) widen too, while textured 2D keeps its size, so art is not stretched. Loading pictures and movies stay 4:3.
  • The scatter (grass) culling uses GpuView().fWidth.

Scopes and binoculars

ZHM3OverlayCameraClass draws the scope, binocular, keyhole and closet masks as a group 495 units in front of its own camera, modelled for the 4:3 picture. Checked on 24 November 2026 in M05 with OPENBLOOD_PCFIXES_TEST=scope (port/engine/debug/_sdl/pcfixestestsdl.cpp; OPENBLOOD_PCFIXES_SNIPER=Custom_SniperRifle gives 47 the W2000, then opens its scope and the binoculars), at 4:3 and in widescreen:

  • Scopes. The W2000's and the air rifle's scopes use the centre camera (USECENTER): a round ring over the normal view, which shows around it at 4:3 too. In widescreen the ring stays round and the picture inside it is the same as at 4:3, since the scope camera's viewport stays in the 4:3 logical pixels. Nothing needs correcting.
  • Binoculars. The mask covered only the middle; both sides showed the unmagnified game view. In widescreen the view now fills the picture outside the 4:3 area black before the overlay camera draws a mask that covers the whole picture: the binoculars, a keyhole, a closet's slats, or a scope without the centre camera (PortOverlayCoversPicture, port/hitman3/camera/_sdl/overlaywidescreensdl.cpp, called from ZOldViewSDL::Clear). This is always on in widescreen. The keyhole and closet masks were not captured.

The PC version handles widescreen differently, and its correction does not carry over:

  • ZHM3Camera::SelectScope (PC 0x5df790) reads the screen size (GetSizeX, GetSizeY: vtable slots 0xb8 and 0xbc of ZRenderWintelD3D at 0x7628ec). When height over width is not 0.75, it divides the scope viewport's height by (height / width) * 4/3, centres it again on its old middle and clamps it to 0..1: on a 16:9 screen the viewport becomes a third taller. Why the PC needs that depends on how its Direct3D renderer maps a camera viewport and the 2D masks to a wide screen, which was not examined. In the port the scope's viewport, the ring and the picture inside it already agree, so the port does not adopt it; a taller viewport would show the scene past the ring.
  • In binocular mode ZHM3Camera::ActivateCurrentCameraMode (PC 0x5dfb00) also calls ZGui::Disable(0), which hides the whole OSD. That is a change of design, not a widescreen correction, and the port hides the OSD when PC tuning is enabled (PC Differences: Classification).

Known limits, for testing:

  • 2D backgrounds made of textured sprites (menu backdrops) do not cover the sides; whatever is behind them shows there.
  • Rooms seen through a portal near the screen edge may be clipped to the portal, as on the PS2; the portal planes come from the portal geometry, so this should not depend on widescreen, but it is untested.
  • The statistics screen sets its overlay camera's aspect to 4:3 when m_bWideScreen is set (statisticsscreen.cpp), which was meant for the anamorphic mode.