Repository navigation
avm2: Implement display-list 3D compose, rotation, and hit tests - #25101
Open
antonylavelle wants to merge 4 commits into
Open
antonylavelle wants to merge 4 commits into
antonylavelle wants to merge 4 commits into
Conversation
Flash DisplayObject.matrix3D is T * Rz * Ry * Rx * S (recompose with Orientation3D.EULER_ANGLES). Concatenate that through the transform stack so rotationX/Y and z affect drawing. Scale world z by the viewport's 2D scale (HiDPI, ShowAll) before perspective, matching Flash's stage-pixel focal length. Skip 2D AABB render culling when a transform uses 3D; pitched tiles can be on screen while their unprojected bounds miss the viewport. Assisted-by: Cursor
2D rotation still wraps into [-180, 180]. Once matrix3D is active, return the native cache so a lerp toward an unbounded heading does not reverse at ±180°. Assisted-by: Cursor
Union the perspective-projected silhouette with the 2D AABB when rotationX/Y or z is in the parent chain. Games such as Microboats hide track obstacles with hitTestObject against a stage rectangle, which misses 2D-offstage clips that the pitch brings on screen. Setting rotationZ now enters display-list 3D like rotationX. Assisted-by: Cursor
Trace 2D vs 3D rotation wrapping, matrix3D Euler order, and hitTestObject of a clip that is below the stage in 2D but on screen after rotationX. Assisted-by: Cursor
Member
This includes a lot of changes, please split it into smaller PRs. e.g. one to support hook up |
Author
|
Ok, I'll have to revisit it later to split and simplify each one into
something smaller. Nearly all of this came from my seperate project on
getting KOLM's 3D working in Ruffle, Microboats was just a huge test case
for it so I thought it would be more useful.
…On Wed, Nov 4, 2026 at 9:57 PM Lord-McSweeney ***@***.***> wrote:
*Lord-McSweeney* left a comment (ruffle-rs/ruffle#25101)
<#25101 (comment)>
This PR does not make sense to split up into smaller PRs.
This includes a lot of changes, please split it into smaller PRs. e.g. one
to support hook up rotationX/rotationY/rotationZ to Matrix3D, one to
support rendering Matrix3D, etc.
—
Reply to this email directly, view it on GitHub
<#25101?email_source=notifications&email_token=ACHIUG2E4OZNF5BTUSFKPQ35XOQ5NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRUGMYTINRWGY3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-6643146666>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACHIUG7HWTTROV5NNWVNAAD5XOQ5NAVCNFSNUABFKJSXA33TNF2G64TZHMYTQMZUHAZTSOBYHNEXG43VMU5TMMRRGIYDMNRXGIZ2C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/ACHIUGYUJRLZKPHBYP4FDTT5XOQ5NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRUGMYTINRWGY3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/ACHIUG633G4HPEANN47ZA3T5XOQ5NA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRUGMYTINRWGY3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This gets Flash 10 display-list 3D (
rotationX/rotationY/z) drawing and hit-testing close enough that Microboats plays correctly. That Armor Games racer is the biggest example of Flash 2.5D I know of: a 2D camera look-at, then the whole world pitched withrotationX, plus standing trackside props (rotationX = 90).What changed:
matrix3Das Flash EulerT * Rz * Ry * Rx * S, and concatenate that through the transform stack.zwith the viewport (HiDPI / ShowAll) so perspective uses stage-pixel focal length instead of looking zoomed out.DisplayObject.rotationin[-180, 180]for 2D, but unwrapped oncematrix3Dis active, so heading lerps (Microboats boats / chase cam) do not reverse at ±180°.world_bounds/hitTestObject, so Microboats'onScreen(hitTestObjectvs a stage rectangle) still shows obstacles that sit off the 2D stage after camera pitch.rotationZnow enters display-list 3D the same wayrotationXdoes.Assisted-by: Cursor.
Testing
tests/tests/swfs/avm2/displayobject_3d(Asc). It traces 2D vs 3D rotation wrapping, Eulermatrix3Dorder, andhitTestObjectfor a clip aty = 500afterrotationX = -60.output.txtis from Ruffle, not yet captured from the Flash Player debugger. That should be re-run in FP and replaced if any line differs (especially 3Drotationwrapping andhitTestObject).Checklist