Render Point Clouds with Three.js in Autodesk Forge using BufferGeometry











up vote
0
down vote

favorite












I'm trying to render point clouds using Autodesk Forge's viewer. This works fine using THREE.Geometry as described here https://forge.autodesk.com/blog/using-pointcloud-forge-viewer. In this article it is specified that one cannot use BufferGeometry.



However, I want to be absolutely sure if there's any way of using PointCloud with BufferGeometry without having to create a THREE.Geometry. I already have the data as Float32Array for the points and Uint8Array for colors so putting them in THREE.Vector3s feels like a lot of overhead here.



Looking through the source https://autodeskviewer.com/viewers/latest/viewer3D.js there's some mention of point cloud buffers, (search for createPointCloudBuffers(geometry).



Edit:



When trying to use THREE.BufferGeometry with THREE.PointCloud with:



const geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(position, 3));
geometry.addAttribute('color', new THREE.BufferAttribute(color, 3));
const pc = THREE.PointCloud(geometry, <material>);


I'm getting the following message:



Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look at renderBufferDirect function in https://autodeskviewer.com/viewers/latest/viewer3D.js)










share|improve this question




























    up vote
    0
    down vote

    favorite












    I'm trying to render point clouds using Autodesk Forge's viewer. This works fine using THREE.Geometry as described here https://forge.autodesk.com/blog/using-pointcloud-forge-viewer. In this article it is specified that one cannot use BufferGeometry.



    However, I want to be absolutely sure if there's any way of using PointCloud with BufferGeometry without having to create a THREE.Geometry. I already have the data as Float32Array for the points and Uint8Array for colors so putting them in THREE.Vector3s feels like a lot of overhead here.



    Looking through the source https://autodeskviewer.com/viewers/latest/viewer3D.js there's some mention of point cloud buffers, (search for createPointCloudBuffers(geometry).



    Edit:



    When trying to use THREE.BufferGeometry with THREE.PointCloud with:



    const geometry = new THREE.BufferGeometry();
    geometry.addAttribute('position', new THREE.BufferAttribute(position, 3));
    geometry.addAttribute('color', new THREE.BufferAttribute(color, 3));
    const pc = THREE.PointCloud(geometry, <material>);


    I'm getting the following message:



    Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look at renderBufferDirect function in https://autodeskviewer.com/viewers/latest/viewer3D.js)










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to render point clouds using Autodesk Forge's viewer. This works fine using THREE.Geometry as described here https://forge.autodesk.com/blog/using-pointcloud-forge-viewer. In this article it is specified that one cannot use BufferGeometry.



      However, I want to be absolutely sure if there's any way of using PointCloud with BufferGeometry without having to create a THREE.Geometry. I already have the data as Float32Array for the points and Uint8Array for colors so putting them in THREE.Vector3s feels like a lot of overhead here.



      Looking through the source https://autodeskviewer.com/viewers/latest/viewer3D.js there's some mention of point cloud buffers, (search for createPointCloudBuffers(geometry).



      Edit:



      When trying to use THREE.BufferGeometry with THREE.PointCloud with:



      const geometry = new THREE.BufferGeometry();
      geometry.addAttribute('position', new THREE.BufferAttribute(position, 3));
      geometry.addAttribute('color', new THREE.BufferAttribute(color, 3));
      const pc = THREE.PointCloud(geometry, <material>);


      I'm getting the following message:



      Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look at renderBufferDirect function in https://autodeskviewer.com/viewers/latest/viewer3D.js)










      share|improve this question















      I'm trying to render point clouds using Autodesk Forge's viewer. This works fine using THREE.Geometry as described here https://forge.autodesk.com/blog/using-pointcloud-forge-viewer. In this article it is specified that one cannot use BufferGeometry.



      However, I want to be absolutely sure if there's any way of using PointCloud with BufferGeometry without having to create a THREE.Geometry. I already have the data as Float32Array for the points and Uint8Array for colors so putting them in THREE.Vector3s feels like a lot of overhead here.



      Looking through the source https://autodeskviewer.com/viewers/latest/viewer3D.js there's some mention of point cloud buffers, (search for createPointCloudBuffers(geometry).



      Edit:



      When trying to use THREE.BufferGeometry with THREE.PointCloud with:



      const geometry = new THREE.BufferGeometry();
      geometry.addAttribute('position', new THREE.BufferAttribute(position, 3));
      geometry.addAttribute('color', new THREE.BufferAttribute(color, 3));
      const pc = THREE.PointCloud(geometry, <material>);


      I'm getting the following message:



      Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look at renderBufferDirect function in https://autodeskviewer.com/viewers/latest/viewer3D.js)







      autodesk-forge autodesk-viewer






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 9:20

























      asked Nov 9 at 15:29









      simen-andresen

      6212823




      6212823
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You might be in luck! Looking at THREE r71 code https://autodeskviewer.com/viewers/latest/three.js



          you can find the point cloud implementation by searching for the text...



          THREE.PointCloud = function ( geometry, material ) {



          notice the input is this.geometry. Now scroll down a few lines down, to find code that shows support for THREE.BufferGeometry as well, here...



          if ( geometry instanceof THREE.BufferGeometry ) {



          Modify these lines of code:
          https://github.com/wallabyway/markupExt/blob/fcce2940379ffd9dc27065fa8dd9b34cd37f8ef0/docs/markupExt.js#L92-L96



          from using 'THREE.Geometry' to 'THREE.BufferGeometry'



          like this...



          var geometry = new THREE.BufferGeometry();
          var vertices = new Float32Array( [ -1.0, -1.0, 1.0, etc ]);
          geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
          geometry.addAttribute( 'color', new THREE.BufferAttribute( vertices, 3 ) );


          Essentially modifying this example to use BufferGeometry...
          https://forge.autodesk.com/blog/3d-markup-icons-and-info-card



          enter image description here



          Let me know if that helps






          share|improve this answer





















          • Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
            – simen-andresen
            Nov 12 at 9:16






          • 1




            ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
            – michael beale
            Nov 19 at 21:26










          • Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
            – simen-andresen
            Nov 20 at 8:44











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228664%2frender-point-clouds-with-three-js-in-autodesk-forge-using-buffergeometry%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          You might be in luck! Looking at THREE r71 code https://autodeskviewer.com/viewers/latest/three.js



          you can find the point cloud implementation by searching for the text...



          THREE.PointCloud = function ( geometry, material ) {



          notice the input is this.geometry. Now scroll down a few lines down, to find code that shows support for THREE.BufferGeometry as well, here...



          if ( geometry instanceof THREE.BufferGeometry ) {



          Modify these lines of code:
          https://github.com/wallabyway/markupExt/blob/fcce2940379ffd9dc27065fa8dd9b34cd37f8ef0/docs/markupExt.js#L92-L96



          from using 'THREE.Geometry' to 'THREE.BufferGeometry'



          like this...



          var geometry = new THREE.BufferGeometry();
          var vertices = new Float32Array( [ -1.0, -1.0, 1.0, etc ]);
          geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
          geometry.addAttribute( 'color', new THREE.BufferAttribute( vertices, 3 ) );


          Essentially modifying this example to use BufferGeometry...
          https://forge.autodesk.com/blog/3d-markup-icons-and-info-card



          enter image description here



          Let me know if that helps






          share|improve this answer





















          • Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
            – simen-andresen
            Nov 12 at 9:16






          • 1




            ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
            – michael beale
            Nov 19 at 21:26










          • Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
            – simen-andresen
            Nov 20 at 8:44















          up vote
          0
          down vote













          You might be in luck! Looking at THREE r71 code https://autodeskviewer.com/viewers/latest/three.js



          you can find the point cloud implementation by searching for the text...



          THREE.PointCloud = function ( geometry, material ) {



          notice the input is this.geometry. Now scroll down a few lines down, to find code that shows support for THREE.BufferGeometry as well, here...



          if ( geometry instanceof THREE.BufferGeometry ) {



          Modify these lines of code:
          https://github.com/wallabyway/markupExt/blob/fcce2940379ffd9dc27065fa8dd9b34cd37f8ef0/docs/markupExt.js#L92-L96



          from using 'THREE.Geometry' to 'THREE.BufferGeometry'



          like this...



          var geometry = new THREE.BufferGeometry();
          var vertices = new Float32Array( [ -1.0, -1.0, 1.0, etc ]);
          geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
          geometry.addAttribute( 'color', new THREE.BufferAttribute( vertices, 3 ) );


          Essentially modifying this example to use BufferGeometry...
          https://forge.autodesk.com/blog/3d-markup-icons-and-info-card



          enter image description here



          Let me know if that helps






          share|improve this answer





















          • Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
            – simen-andresen
            Nov 12 at 9:16






          • 1




            ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
            – michael beale
            Nov 19 at 21:26










          • Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
            – simen-andresen
            Nov 20 at 8:44













          up vote
          0
          down vote










          up vote
          0
          down vote









          You might be in luck! Looking at THREE r71 code https://autodeskviewer.com/viewers/latest/three.js



          you can find the point cloud implementation by searching for the text...



          THREE.PointCloud = function ( geometry, material ) {



          notice the input is this.geometry. Now scroll down a few lines down, to find code that shows support for THREE.BufferGeometry as well, here...



          if ( geometry instanceof THREE.BufferGeometry ) {



          Modify these lines of code:
          https://github.com/wallabyway/markupExt/blob/fcce2940379ffd9dc27065fa8dd9b34cd37f8ef0/docs/markupExt.js#L92-L96



          from using 'THREE.Geometry' to 'THREE.BufferGeometry'



          like this...



          var geometry = new THREE.BufferGeometry();
          var vertices = new Float32Array( [ -1.0, -1.0, 1.0, etc ]);
          geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
          geometry.addAttribute( 'color', new THREE.BufferAttribute( vertices, 3 ) );


          Essentially modifying this example to use BufferGeometry...
          https://forge.autodesk.com/blog/3d-markup-icons-and-info-card



          enter image description here



          Let me know if that helps






          share|improve this answer












          You might be in luck! Looking at THREE r71 code https://autodeskviewer.com/viewers/latest/three.js



          you can find the point cloud implementation by searching for the text...



          THREE.PointCloud = function ( geometry, material ) {



          notice the input is this.geometry. Now scroll down a few lines down, to find code that shows support for THREE.BufferGeometry as well, here...



          if ( geometry instanceof THREE.BufferGeometry ) {



          Modify these lines of code:
          https://github.com/wallabyway/markupExt/blob/fcce2940379ffd9dc27065fa8dd9b34cd37f8ef0/docs/markupExt.js#L92-L96



          from using 'THREE.Geometry' to 'THREE.BufferGeometry'



          like this...



          var geometry = new THREE.BufferGeometry();
          var vertices = new Float32Array( [ -1.0, -1.0, 1.0, etc ]);
          geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
          geometry.addAttribute( 'color', new THREE.BufferAttribute( vertices, 3 ) );


          Essentially modifying this example to use BufferGeometry...
          https://forge.autodesk.com/blog/3d-markup-icons-and-info-card



          enter image description here



          Let me know if that helps







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 3:56









          michael beale

          29113




          29113












          • Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
            – simen-andresen
            Nov 12 at 9:16






          • 1




            ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
            – michael beale
            Nov 19 at 21:26










          • Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
            – simen-andresen
            Nov 20 at 8:44


















          • Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
            – simen-andresen
            Nov 12 at 9:16






          • 1




            ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
            – michael beale
            Nov 19 at 21:26










          • Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
            – simen-andresen
            Nov 20 at 8:44
















          Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
          – simen-andresen
          Nov 12 at 9:16




          Thanks. Have you actually got it working though ? I've tried this, but I'm getting the following: Only THREE.Mesh can be rendered by the Firefly renderer. Use THREE.Mesh to draw lines. (Look for relevant code in autodeskviewer.com/viewers/latest/viewer3D.js)
          – simen-andresen
          Nov 12 at 9:16




          1




          1




          ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
          – michael beale
          Nov 19 at 21:26




          ah, now I see. Let me ask the team and find out if there is a workaround (and possibly future support coming)...
          – michael beale
          Nov 19 at 21:26












          Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
          – simen-andresen
          Nov 20 at 8:44




          Thanks Michael, that would be great! Not being able to use BufferGeometry for point clouds makes our webapp quite slow since we need to convert the buffers we have into THREE.Vector3D vertices etc before rendering
          – simen-andresen
          Nov 20 at 8:44


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228664%2frender-point-clouds-with-three-js-in-autodesk-forge-using-buffergeometry%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Schultheiß

          Liste der Kulturdenkmale in Wilsdruff

          Android Play Services Check