# Hidden vector graphics (3D)

Page 3/3
1 | 2 |

Object sorting works in a weird way in the original actually! I would have expected objects to be sorted after transformed into camera coordinates (just sorting by Z), but no! They are sorted before hand, sorting by distance from the player! Very cunorthodox, but appears to work, at least for the simple rooms they had haha

https://braingames.santiontanon.dev/games/disassembly/castle...

[And man! I see my annotations are full of typos haha, I should revise and update lol]

Oh, that's actually potentially a relevant point re: hidden face removal as per earlier. I preferred transforming the viewer into the space of the object over transforming all object surface normals into the space of the viewer because it's one transform versus n transforms — and if you've limited yourself to rotations and transformations then it's not expensive to work out the implied inverse transform. Indeed it's just the transpose of the 3x3 rotational matrix.

EDIT: but, otherwise, for the Freescape case the big thing is that objects all lie within a particular cuboid and that cuboid does not overlap with any other. So I'd imagined something like an object-by-object sort where the solution to "which object is closer" for any given pair is to find any of the potential (x, y, z) planes that separates them — there'll always be at least one — and then order based on relative player position. E.g. comparing an object A that ends at x=6 to an object B that begins at x=9 could mean asking "is the player at or beyond x=6? If so then B is closer than A, otherwise A is closer than B". Then just sort of fudge those object-by-object decisions to get a good-enough-for-gaming solution for the whole set of objects, accepting that there are many cases that can't be solved as a simple object ordering and therefore inconsistencies will abound but not worrying about it because it's a game.

But, yeah, I didn't manage to get anything 'good enough' even for the specialised meaning of 'as good as the original Freescape engine'.

Page 3/3
1 | 2 |