4

I was looking to upgrade the three js which is used in autodesk forge behind the scene and reason for upgrade is I am trying to use this library and this need three js r71 and above and inside forge viewer it seems they are using r33. I found a blog where it showed me how can I take the advantage of later three js. I followed it but seems like its not working. There forge viewer now have 2 references of three js and it gets confused which one to use and hence some of code behave weird

here is one of the example happening to me

THREE.Object3D.add: object not an instance of THREE.Object3D. 

I am getting this when I am trying to add a scene

some might would like to know what was happening with the three js which comes with forge viewer so here is the thing which is getting broken

I have also tried doing this below things adding source to three js

 <script src=" https://cdnjs.cloudflare.com/ajax/libs/three.js/r122/three.min.js"></script>

So is there any other solution which I can try and make it work also If someone had tried meshline library and faced similar issue and have solution for it do let me know

Ronak Shetiya
  • 960
  • 6
  • 27

1 Answers1

1

Forge Viewer uses Three.js version 71, and due to the way both libraries are written, it is unfortunately very difficult to port Forge Viewer to more modern versions of Three.js.

You can try back-porting parts of Three.js that you're interested in manually (I did that for the Potree point cloud library), but such work is not an officially supported.

Petr Broz
  • 8,891
  • 2
  • 15
  • 24
  • thanks petr and how about this error THREE.WebGLRenderer: Unknown uniform type: undefined – Ronak Shetiya Nov 26 '20 at 13:38
  • How did you find the THREE.js version was 71?? – Hiroshi Nishio Mar 17 '23 at 05:23
  • When I started the viewer and opened the console log, it said "THREE.WebGLRenderer 71". I wonder if this is what you are talking about. – Hiroshi Nishio Mar 17 '23 at 06:12
  • Yes, when the viewer loads its specific version of three.js, the version is logged in the console. If you see anything other than `THREE.WebGLRenderer 71`, there's a chance you're loading a different version of three.js somewhere else, and there might be some clashes. – Petr Broz Mar 17 '23 at 08:07