Jump to content

Problem with loading JSON file into babylon


Pawan Jadhav
 Share

Recommended Posts

Currently we are using threeJS to render webgl content.

Here is what i do :

We have  Jupiter Tesselation  formated files, we convert these files to Json format. We are able to load these JSON files into threeJS.

But i couldn't see any option in babylon where i can load these JSON files.

See attached JSON files

1.json

2.json

Link to comment
Share on other sites

Hi, I wrote a partial 3 JS importer and thought that I could add on to use your file as well but ran into an issue. 

Does 1.json load into Three js ? Looking at the faces array the format looks wrong. 

 

"faces":[
         80, 0, 1, 2, 0, 0,

80 means index to face color, but you have only one color and yet there are several indices. 

    "colors":[
        3355443
    ],

 

This is the code to decode it. 

if ( hasFaceVertexColor ) {
   
  for ( i = 0; i < 3; i ++ ) {
   
  colorIndex = faces[ offset ++ ];
  face.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );
   
  }
   
  }

 

new THREE.Color( colors[ colorIndex ] would explode because there is only one color in the file. 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...