r/howdidtheycodeit • • Sep 09 '26

Fixed point math in C

https://thatonegamedev.com/cpp/fixed-point-math-in-c/

Why did PS1 graphics looked so clunky and how where 3D graphics generally made prior to the graphical APIs. One thing I found out was that these older engines have something called fixed point math.

24 Upvotes

16 comments sorted by

View all comments

Show parent comment

12

u/noobgiraffe Sep 09 '26

Fixed point math doesn't really have any hard-wired relationship to PS1 3D graphics.

Why are you upvoated when you are so wrong.

Therefore, many programmers implemented so-called "fixed point" math systems, where they would just say to themselves "this variable has a fixed decimal point at the 'thousands' position. Therefore if it holds the value 50,000 - it's really 50. If it's the value 4501, it's really 4.501.

Not many but all and they didn't implement it, it is how psx hardware worked. It was many, many years before shaders so entire 3d transformation code was baked into hardware. It had specific fixed point precision defined by this hardware.

This precision was low and caused vertices to "snap" into specific spots instead of smoothly moving. That's the clunkiness OP is asking about, and it's partialy caused by fixed point math in itself and partially by the fact that fixed point math in psx gpu having few bits of precision.

This effect is replicated today by many demake, and psx lookalike games by rounding vertex positions in the shader so specific precision.

3

u/ironykarl Sep 14 '26 edited Sep 14 '26

Yeah. It's a shame that that's the highest upvoted reply in this thread. 

Like, yeah... affine texture mapping is another major component of PlayStation graphics (they got that part right, at least)...

That along with small textures, lack of anti-aliasing, and built-in dithering are key parts of the PS1 aesthetic.

But yeah, the effects of fixed point math in 32 bits definitely can't be denied.

2

u/Nanocephalic Sep 09 '26

> rounding vertex positions in the shader

Time is a loop!

2

u/tyler1128 Sep 11 '26

Something 10-20 years old is uncool because it's what your parents used. By about 30 years, it becomes cool again, see the rise of cassette tapes again among many other things.