#Unable to load gltf models but they load when imported to gltf viewer

9 messages · Page 1 of 1 (latest)

pure tusk
#

hey!

THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Material Name: Material_35
Material Type: MeshStandardMaterial
Program Info Log: Must have a compiled vertex shader attached:
SHADER_INFO_LOG:
ERROR: 0:387: 'uvundefined' : undeclared identifier
ERROR: 0:387: 'constructor' : not enough data provided for construction
VERTEX
ERROR: 0:387: 'uvundefined' : undeclared identifier
ERROR: 0:387: 'constructor' : not enough data provided for construction

  382: void main() {
  383: #if defined( USE_UV ) || defined( USE_ANISOTROPY )
  384:     vUv = vec3( uv, 1 ).xy;
  385: #endif
  386: #ifdef USE_MAP
> 387:     vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  388: #endif
  389: #ifdef USE_ALPHAMAP
  390:     vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  391: #endif
  392: #ifdef USE_LIGHTMAP
  393:     vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
three.module.js:6505:13
    onFirstUse three.module.js:6505
    getUniforms three.module.js:6578
    setProgram three.module.js:17089
    renderBufferDirect three.module.js:15831
    renderObject three.module.js:16756
    renderObjects three.module.js:16725
    renderScene three.module.js:16565
    render three.module.js:16383
    animate main.js:142
    (Async: FrameRequestCallback)
    animate main.js:143
    (Async: FrameRequestCallback)
    animate main.js:143
    (Async: FrameRequestCallback)
    animate main.js:143
    onAnimationFrame three.module.js:16204
    onAnimationFrame three.module.js:18
    (Async: FrameRequestCallback)
    start three.module.js:31
    setAnimationLoop three.module.js:16230
    <anonymous> main.js:18
#
WebGL warning: linkProgram: Must have a compiled vertex shader attached:
SHADER_INFO_LOG:
ERROR: 0:387: 'uvundefined' : undeclared identifier
ERROR: 0:387: 'constructor' : not enough data provided for construction
WebGL warning: useProgram: Program must be linked successfully. 31
After reporting 32, no further warnings will be reported for this WebGL context.```
#
import { GLTFLoader } from 'https://cdn.skypack.dev/[email protected]/examples/jsm/loaders/GLTFLoader.js';

const loader = new GLTFLoader();

loader.load(
    'models/gltf/apple/scene.gltf',
    function (gltf) { 
        scene.add(gltf.scene);
    },
    // called while loading is progressing
    function ( xhr ) {

        console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

    },
    // called when loading has errors
    function ( error ) {

        console.log( 'An error happened' );

    }
);

this is how i'm loading them

exotic island
#

You’re using GLTFLoader from r133 here. My guess is that your projects ThreeJS version is something else. Make sure your versions match

pure tusk
#

no change

#

Okay nvm, it worked

#

thank you Faraz, matching the versions worked