Map projections' depth like the client's renderer

IMVU's projections give depth from -1 to 1; its Direct3D renderer maps it to 0 to 1, and now so does ours. Without that, the nearer half of the depth range was clipped, the whole 2D overlay (name tags, the frame rate, the room's title) with it. The adapter also draws drawTrianglesFromMemory without indices, and sums up what the client draws in its log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-28 07:01:47 -07:00
1 parent 299cd8c312
commit 3cdda4c7ed
6 files changed
+78 -43

No files matched your search

+15 -2
View File
@@ -36,8 +36,21 @@ client exits.
## Status
The renderer process draws the client's whole scene, over the right half of the 3D view, beside the client's own
Direct3D renderer on the left (the adapter still forwards everything to it): `T5DE_RENDERER_VIEW=full` or `off`
changes that. Checked in rooms: the halves match, particles included.
Direct3D renderer on the left (the adapter still forwards everything to it). Checked in rooms with screenshots of
both renderers side by side (the compare view): they match, particles and the 2D overlay (name tags) included.
For comparing while the client runs (development):
- Views: `T5DE_RENDERER_VIEW` (off, split, full or compare) when the client starts, or
`%TEMP%\t5de-renderer-view.txt` holding one of those at any time. Compare draws the left half's scene over the
right half, so both renderers show the same thing side by side.
- `%TEMP%\t5de-renderer-shaders\fixed_function.hlsl`, if present, replaces the built-in shaders and is reloaded
when it changes.
- The renderer process runs from a copy (`%TEMP%\t5de-renderer`), so `t5de-renderer.exe` can be replaced while the
client runs; engines started afterwards run the new one (the room's view keeps its engine until the client
restarts).
- The adapter's log (`%TEMP%\t5de-renderer.log`) sums up what the client draws every 300 frames (the first few
times), and logs textures and render targets the client renderer made itself.
- The command stream (`include/t5de/protocol/commands.hpp`) carries state, transforms, lights, fog, textures,
buffers (copied when created or updated) and draws, in chunks through the channel; the adapter waits for each to
+9 -2
View File
@@ -71,9 +71,16 @@ virtual methods, IMVU's code only uses an engine through helpers that call its v
vertical field of view, Direct3D's 0 to 1 depth) and an orthographic one for 2D, orthonormal view rotations,
opaque clear colors, ambient light with zero alpha, linear fog (1 to 50), scrolling texture transforms. Furniture
vertices are interleaved: positions and normals are 12-byte elements 32 bytes apart, so strides matter.
- Projections give depth from -1 to 1, as OpenGL's do: IMVU's Direct3D renderer multiplies them by a matrix
mapping it to 0 to 1 (z' = z / 2 + w / 2) and shifting them half a pixel (-1 / width, +1 / height, for Direct3D
9's pixel centers). Without the depth mapping, everything in the nearer half of the depth range is clipped: the
2D overlay (name tags, the frame rate, the room's title) is drawn at depth -0.98.
- The 2D overlay is ordinary `drawTriangles` with an orthographic projection (a few per frame), textured with text
IMVU draws with GDI into bitmaps.
- Particles (`drawPointSprites`): a Visual C++ 2010 `std::vector` of 16-byte points (position, color), drawn as
Direct3D 9 point sprites: squares viewport height / distance pixels across (Direct3D 9's defaults clamp them to
1 to 64; IMVU sets only the size, 1, and the scale factors 0, 0, 1), textured over the whole square.
Direct3D 9 point sprites: squares viewport height / distance pixels across (IMVU sets the size, 1, and the scale
factors 0, 0, 1), textured over the whole square. Direct3D 9's documented 64-pixel default limit doesn't apply in
practice: clamped to it they look much smaller and fainter than the client's.
- Fog: linear table fog, start 1 and end 50 in rooms. Fogging by view depth matches the client; by depth buffer
value (as Direct3D 9's documentation suggests for projections like IMVU's) doesn't.
- Still unknown: render targets, `CompoundRegion` (texture update