Giter Site home page Giter Site logo

Comments (3)

donmccurdy avatar donmccurdy commented on August 17, 2024

@marwie do you feel that the message is inaccurate or shouldn't be a warning? Or just that the logging is too noisy? Note that sparse() will detect these and remove them.

from gltf-transform.

marwie avatar marwie commented on August 17, 2024

It feels noisy
I'm also not sure how/why the percentage rate increases - is this expected?
Regarding sparse: would you recommend that I add a call to sparse() by default?

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

Current behavior is that for each accessor marked as sparse, I/O will log a warning if the % of non-zero values in the accessor is above the threshold at which use of sparse accessors increases final file size:

if (count > accessor.getCount() / 3) {
// Too late to write non-sparse values in the proper buffer views here.
const pct = ((100 * indices.length) / accessor.getCount()).toFixed(1);
logger.warn(`Sparse accessor with many non-zero elements (${pct}%) may increase file size.`);
}

Perhaps I've got the threshold slightly wrong though, there's a (small) file size increase if we make these accessors non-sparse. In general there's no harm including sparse() by default, it should only change accessors if they benefit. It's included in the CLI 'optimize' command for example:

transforms.push(sparse());

This does require a pass over ever element of every accessor, so if you're really tight on the processing time budget, maybe better to do something targeted only to morph target accessors.

In any case, I'm open to making this logging less noisy.

from gltf-transform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.