ScratchData LogoScratchData
Back to ChromeCat_test's profile

view transform test - 4x4 mat vs affine+proj

CHChromeCat_test•Created June 2, 2025
view transform test - 4x4 mat vs affine+proj
10
7
152 views
View on Scratch

Instructions

99% can just ignore this. I just wanted to time the current view transform loop that I use in simple 3D engine VS a version that uses a 4x4 mult to combine the translation, rotation, and focal mult (and clip transform) into one. (lower number = faster) When both are optimised they are similar, but 4x4 is doing more operations so it's a little slower. Big advantage of the 4x4 though is that the stored vertex coordinates are in clip space instead of view space. This would be even more useful if the model transform matrix was combined with it too. I did find that a 5% optimisation was possible by combining the rot and trans into a true affine, though but it's kind of insignificant. Created in response to @costc075202 who suggested using a 4x4 mat as a potential optimisation to the viewTransform pipeline. This is designed as an improved, fairer version of https://scratch.mit.edu/projects/1183112815/

Project Details

Project ID1183699671
CreatedJune 2, 2025
Last ModifiedJune 2, 2025
SharedJune 2, 2025
Visibilityvisible
CommentsAllowed