Faulty Rendering with CFrames

Found some really, really weird rendering issues:
I was trying to convert animation keyframeSequences to raw CFrames that I can BulkMove to avoid the overhead of humanoids
Still haven’t figured that out yet but while debugging I noticed that the angles were all in the wrong axes. I swapped the axes around using an axisFix CFrame from a custom matrix like so. here’s the full code; a localscript in starterplayer:

local rig = workspace:WaitForChild("Rig")
local torso = rig.Torso

local keyframe = workspace:WaitForChild("Keyframe")
local keyframeHRP = keyframe.HumanoidRootPart
local keyframeTorso = keyframeHRP.Torso


local part = Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(2,2,1)


local relativeTransform = keyframeHRP.CFrame:ToObjectSpace(keyframeTorso.CFrame)

local axisFix = CFrame.fromMatrix(
    Vector3.new(),
    Vector3.new(-1, 0, 0),
    Vector3.new(0, 0, 1),
    Vector3.new(0, -1, 0)
)

part.CFrame = torso.CFrame * relativeTransform * axisFix


print(part.CFrame)
part.Parent = workspace

-- this is what it should be
local otherPart = Instance.new("Part")
local otherCF = CFrame.new(10.8999939, 2.99999952, 3.89999628, -0.707106888, 0, -0.70710665, 0, 1, 0, 0.70710665, 0, -0.707106888)
otherPart.Anchored = true
otherPart.Size = Vector3.new(2, 2, 1)
otherPart.BrickColor = BrickColor.new("Bright red")
otherPart.CFrame = otherCF
otherPart.Parent = workspace

With this specific axisFix, I think the vertex ordering used for backface culling is reversed so we see all the faces that we shouldn’t rather than the faces we should. See the following video:

External Media

Part CFrame: 10.8999939, 3, 3.89999676, 0.707134247, 0, -0.707079291, -0.707079291, 0, -0.707134247, 0, -1, 0

The weird part is that with a different axisFix, namely this one:

local axisFix = CFrame.fromMatrix(
    Vector3.new(),
    Vector3.new(-1, 0, 0),
    Vector3.new(1, 0, 0),
    Vector3.new(0, 1, 0)
)

a totally different rendering flaw appears: a rather ominous shadow appears that’s negated by the camera? honestly a pretty cool effect

External Media

The NAN in the Part’s CFrame may be part of the issue, though.

sysinfo:
CPU 11th Gen Intel(R) Core™ i5-11320H @ 3.20GHz Base speed: 2.50 GHz Sockets: 1 Cores: 4 Logical processors: 8 Virtualization: Enabled L1 cache: 320 KB L2 cache: 5.0 MB L3 cache: 8.0 MB Utilization 36% Speed 3.40 GHz Up time 0:01:12:03 Processes 272 Threads 3949 Handles 129676
Memory 8.0 GB Speed: 3200 MT/s Slots used: 2 of 2 Form factor: SODIMM Hardware reserved: 257 MB Available 761 MB Cached 666 MB Committed 15.4/21.7 GB Paged pool 356 MB Non-paged pool 1015 MB In use (Compressed) 7.0 GB (1.3 GB)
Disk 0 (C:)

NVMe PC SN740 NVMe WD 512GB

Capacity:	477 GB
Formatted:	439 GB
System disk:	Yes
Page file:	Yes
Type:	SSD

Read speed	5.9 MB/s
Write speed	404 KB/s
Active time	7%
Average response time	0.2 ms

GPU 0

Intel(R) Iris(R) Xe Graphics

Driver version:	32.0.101.6078
Driver date:	13/09/2024
DirectX version:	12 (FL 12.1)
Physical location:	PCI bus 0, device 2, function 0

Utilization	6%
Dedicated GPU memory	
Shared GPU memory	1.2/3.9 GB
GPU Memory	1.2/3.9 GB

Here’s the RBXL:
strangeRenderingBugThing.rbxl (77.1 KB)

P.S. if anyone knows the actual, correct axisFix or the right way to transform the axes, please let me know :pray:

Expected behavior

no rendering bugs preferably :pray:

A private message is associated with this bug report

i figured out the pose cframe stuff; i have a severe case of “not reading the docs carefully enough” and completely missed the bit where it says the Motor6D is what the Pose.CFrame reflects. :sweat_smile:
Still doesn’t explain the strange rendering bugs.