Hacker News new | ask | show | jobs
by jbreckmckye 1040 days ago
So when you're drawing triangles on the PSX, do you basically get the GTE hardware to figure out your coordinates, before putting those into the appropriately indexed packet?

I'm guessing this explains the PSX-specific artefacts you would see when rotated triangles would "clip" into each other at the seams of models. The ordering would just come from the average Z coord of the plane.

1 comments

You are right: unlike modern platforms with vertex shading capabilities, the geometry pipeline runs entirely on the CPU and GTE. The GPU is a "black box" that operates exclusively in screen space and only gets access to transformed X/Y coordinates, which is also why it cannot calculate the depth of each pixel and use it to apply perspective correction to projected textures [1].

[1] https://en.wikipedia.org/wiki/Texture_mapping#Affine_texture...

I wonder how perspective corrected texture mapping works on emulators.

Maybe the coordinate values passed from GTE to GPU are "shadowed" with extra data about the transformation, that is then retrieved further down the pipeline

I suppose there could be multiple approaches

Huh. I never thought about this. One of the advantage of some of these emulators is being able to fix the perspective issue on the texture-mapping, but of course most 90s games were doing the texture-mapping in 2D and the 3D points had already been projected into screen space.

This isn't an easy problem to solve. I can't think of a way you could back figure the Z from the rendered data. The only other solution I can think of is to somehow break the models up into smaller polys as they are loaded into memory. If you break them up the individual triangles will be smaller and the lack of perspective won't show.

There actually is a relatively simple, if hacky, way to accomplish this: the emulated GTE can push the Z coordinate (and optionally the full-precision X/Y coordinates) of each processed vertex into a private key-value store, using the rounded X/Y result returned to the game as a key. The emulated GPU can then look up the coordinates provided by the game - assuming they were passed as-is from the GTE, which is the case for the vast majority of games - in the same store to obtain the Z values.

This does not seem to be a new approach, as PC ports of PS1 games used similar tricks all the way back in 2000 [1].

[1] https://news.ycombinator.com/item?id=3581350 https://news.ycombinator.com/item?id=29493242