Opened 10 years ago

Last modified 3 years ago

#2026 new defect

[PATCH] Skinning optimisations.

Reported by: tuan kuranes Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Core engine Keywords:
Cc: Patch: Phab:D2458

Description (last modified by Stan`)

Skeletal animations skinning optimisations

A TODO patch followup, must have is :

Note that there is a serious questions about them being useful at all CPU side, and a flag in model.xml file should be telling code wheter or not computing bounding box each frame for each unit. check with breakpoints in CModel::GetWorldBoundsRec

Unless in the case of a "crane" or very long object with animation changing significantly its bounding box, keeping the static compute box is more than enough and would give serious CPU perf gains.

Attachments (4)

skinning.patch (29.3 KB ) - added by tuan kuranes 10 years ago.
skinning_update.patch (28.8 KB ) - added by sanderd17 9 years ago.
cleanedup.patch (4.4 KB ) - added by wraitii 9 years ago.
skinning0.patch (2.0 KB ) - added by fsincos 7 years ago.
Batch processing version of SkinPoint.

Download all attachments as: .zip

Change History (20)

by tuan kuranes, 10 years ago

Attachment: skinning.patch added

comment:1 by tuan kuranes, 10 years ago

Description: modified (diff)
Summary: Skinning optimisations.[PATCH] Skinning optimisations.

comment:2 by Kieran P, 10 years ago

Keywords: patch review added
Milestone: BacklogAlpha 14
Priority: Should HaveNice to Have

comment:3 by tuan kuranes, 10 years ago

Description: modified (diff)

comment:4 by historic_bruno, 9 years ago

Owner: set to tuan kuranes

comment:5 by Kieran P, 9 years ago

Milestone: Alpha 14Alpha 15

by sanderd17, 9 years ago

Attachment: skinning_update.patch added

comment:6 by sanderd17, 9 years ago

updated the patch to SVN r13672

comment:7 by wraitii, 9 years ago

Milestone: Alpha 15Alpha 16

by wraitii, 9 years ago

Attachment: cleanedup.patch added

comment:8 by wraitii, 9 years ago

Removed everything that definitely wasn't an optimization/was too big an obfuscation. As you can see, there is not much left.

in reply to:  8 comment:9 by historic_bruno, 9 years ago

Replying to wraitii:

Removed everything that definitely wasn't an optimization/was too big an obfuscation. As you can see, there is not much left.

Thanks! Looks pretty good, in the sense of eliminating some copies and allocations. But the functions aren't very intuitive now, it's unusual to have a function with one input parameter that it appends and returns the result into. At least the doxygen comments should be updated to reflect that (we can pretend people actually read them).

It's better to add a forward class declaration to header files and include headers in the cpp file (for CBoundingBoxAligned).

Line 45 in ModelDef.cpp should be indented.

Line 428 of Model.cpp breaks rendering, A *= B isn't the same as A = A * B, it seems to be premultiplying (A = B * A).

comment:10 by leper, 9 years ago

Milestone: Alpha 16Alpha 17

comment:11 by historic_bruno, 9 years ago

Owner: tuan kuranes removed

comment:12 by historic_bruno, 9 years ago

Keywords: review removed

comment:13 by Itms, 8 years ago

Milestone: Alpha 17Alpha 18

comment:14 by leper, 8 years ago

Milestone: Alpha 18Backlog

by fsincos, 7 years ago

Attachment: skinning0.patch added

Batch processing version of SkinPoint.

comment:15 by fsincos, 7 years ago

I have attached a slightly different approach, SkinPoint gets a "batched" version. For some odd reason, this seems to speed it up significantly. Maybe it's because of less function call overhead, maybe it's because GCC optimized this version to use SSE. Overall, it shaved around 0.5% CPU time off a full replay.

comment:16 by Stan`, 3 years ago

Description: modified (diff)
Keywords: patch removed
Patch: Phab:D2458

I had a look at the code fsincos but it doesn't work for me. The non-rigged meshes look fine, but the animated ones are totally broken, because the logic is incorrect. If you look carefully your batch processing doesn't batch them in the same way.

Note: See TracTickets for help on using tickets.