playcanvas / playcanvas/engine

batching.js code comment. And add support for batching animated Skinned models?

Open
#1,231 1 comment 0 reactions 1 assignee View on GitHub

@mvaligursky is already working on this.

Since Feb 7, 2020.

area: graphics
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

I've got a code comment regarding:

                // Split by instance number
                if (i === meshInstancesLeftA.length) {
                    meshInstancesLeftB = [];
                } else {
                    meshInstancesLeftB = meshInstancesLeftA.slice(i + 1);
                }

Isn't the if (i === meshInstancesLeftA.length) { an impossible/redundant case check? You've already accessed meshInstancesLeftA[i] which is assumed within range and won't be undefined. i=== meshInstancesLeftA.length will never happen, i think. The else case should be sufficient enough, right?

Also, refer to the changes I did in batching.js on my fork that supports Skinned batching.
https://github.com/Glidias/engine/blob/master/src/scene/batching.js

Test project with scripts/3rd/modpc.js hacks wit batching (View in EDITOR).
https://playcanvas.com/editor/scene/613629
I tested with a bunch of soldiers + ships all using the same batch group, they seem to be all batched to 1 group, all split okay if exceeded maxInstance count limit. THe mods also include allowing batching with custom shader chunks (as shown in the green y-view-scaled billboards when you spawn on the map).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.