Giter Site home page Giter Site logo

Comments (14)

Samsy avatar Samsy commented on August 17, 2024 2

Actually reporting the same issue

On this model in particular :
https://github.com/Samsy/glbs/blob/main/sample.glb

Using the command line CLI ( 3.4.0 ) to instance it results good :
https://github.com/Samsy/glbs/blob/main/sample-instanced-good.glb

Screenshot 2024-02-08 at 15 30 28

But using GLTF report script to instance dont show anything, I opened the file on threejs editor, and does not seem to be correct. ( also tested on nodejs packages, no luck )

https://github.com/Samsy/glbs/blob/main/sample-instanced-broken.glb

Screenshot 2024-02-08 at 15 30 50

I also noticed, flatten does not seem to work on GLTF-report scripts

Flatten using cli ( 3.4.0 ) :

Screenshot 2024-02-08 at 15 44 46

Flatten using GLTF report scripts :

Screenshot 2024-02-08 at 15 44 24

from gltf-transform.

Samsy avatar Samsy commented on August 17, 2024 1

Thank you very much, I'm going to check this !

from gltf-transform.

harrycollin avatar harrycollin commented on August 17, 2024 1

Thank you @donmccurdy. Sorry I missed your request above for more info. I'm not sure I can avoid using clone(), so I'll test in v4 :D

from gltf-transform.

Samsy avatar Samsy commented on August 17, 2024 1

I tested the next cli, confirms flatten / dedup / instance work as expected

Is there a way to install the "@next" version with node js ?

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

Confirmed, thanks @harrycollin! I'm seeing the same issue in the latest stable version v3.10.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

I've been able to reproduce this error in https://gltf.report, but I can't reproduce it in a Node.js script or in the CLI, and it's fairly difficult to debug in the web app. if you're able to observe the error in Node, do you mind sharing how you went about that? Things that might be important:

  • Node.js version
  • ES Modules or CommonJS
  • TypeScript or JavaScript
  • any build tools, and config files if applicable

Thanks!

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

Note to self — broken version of the file contains no accessors in the instance TRS transforms.

Correct:

    {
      "mesh": 30,
      "extensions": {
        "EXT_mesh_gpu_instancing": {
          "attributes": {
            "TRANSLATION": 0,
            "ROTATION": 1,
            "SCALE": 2
          }
        }
      }
    },

Broken:

        {
            "mesh": 30,
            "extensions": {
                "EXT_mesh_gpu_instancing": {
                    "attributes": {}
                }
            }
        },

from gltf-transform.

harrycollin avatar harrycollin commented on August 17, 2024

Thanks for looking at this! I first noticed this in my Node environment. My bundled version of glTF-Transform is higher than that used on https://gltf.report.

Info:

  • glTF-Transform 3.10.0
  • Node 18.x
  • ES Modules
  • Typescript
  • Bundled with esbuild
  • Banner config for esbuild:
  import { fileURLToPath } from 'url';
  import * as path from 'path';
  import { createRequire as topLevelCreateRequire } from 'module';
  const require = topLevelCreateRequire(import.meta.url);
  const __filename = fileURLToPath(import.meta.url);
  const __dirname = path.dirname(__filename);

from gltf-transform.

harrycollin avatar harrycollin commented on August 17, 2024

if you're able to observe the error in Node

I created a very simple node script but couldn't reproduce the problem. However in my bundled version (info above) the problem still occurs. I can't think of anything else right now that would cause this to happen. I'll keep digging in the meantime.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

I have a hunch this might be a case of dual package hazard. Certain build configurations compiling ESM to CJS (for example) can cause two copies of a dependency to be loaded. If the @gltf-transform/functions package imports code from one copy of @gltf-transform/core but is given an input document from another copy, lots of unpredictable bugs can happen, like material instanceof Material returning false.

If that's the case, setting output to ESM in either your ESBuild or TypeScript configuration would likely fix it ... see #857 (reply in thread) for a similar bug and resolution.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

Would someone be able to share a Node.js script that reproduces this error, along with the specific bundlers and typescript configurations (if any) used to build and run that script? The script in the top post is fine, but I think the build processes compiling it are creating problems.

I'm fairly confident this has to do with dual package hazard. Presumably I can fix the issue in glTF Report, but if you're running into the same issues in your own code, your build process may also need a configuration change. Targeting ESM (whatever that means in your build system) tends to resolve this problem.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

I've found the cause — partial fix in #1269, but there are a few pieces of the solution I still need to figure out before merging.

Doesn't look like build processes or dual package hazard were to blame.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

Fixed and published to 4.0.0-alpha.6. If you'd like to test that fix, you can use the @next tag, like npm install @gltf-transform/cli@next. glTF Report will be updated after the v4 stable release, which I'm hoping will happen by the end of March.

The issue was related to document.clone() leaving the scene graph in a subtly broken state, so if you need a workaround in v3 in the meantime, avoiding document.clone() should sidestep the issue.

from gltf-transform.

donmccurdy avatar donmccurdy commented on August 17, 2024

@Samsy yes – if you're using the scripting API in a node.js environment you'd probably want:

npm install --save @gltf-transform/core@next @gltf-transform/extensions@next @gltf-transform/functions@next

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.