Search Unity

Graphics.DrawProcedural isn't in 3d space?

Discussion in 'Scripting' started by lmbarns, Aug 21, 2014.

  1. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    I'm passing an array of Vector3's to a compute shader and using Graphics.DrawProcedural to render it on the GPU.

    I can see it in the camera just fine, but if I look in the scene it's not there....so does it only show on a camera? Any way to force it in 3d space?

    I was using the same array of vector3 points to dynamically generate a mesh, but performance was much slower, and mesh limits at 65,000 vertices, while I have around 230k vertices to draw...so has to be several meshes.

    With the Graphics.DrawProcedural it was rendering 2.5million points at 60fps....

    With just a regular mesh as low as 15k points it runs at 15fps...
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Graphics.DrawProcedural Only draws on the camera.
    Why would you even want it in scene views in the editor? They do not exist in builds
     
  3. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    Arg, I've been using Mesh.SetIndices() but it's too slow, with a reduced size, 15,000 vector3 points it runs at 10fps.

    With a compute shader I was pushing 2.5mil points at 60fps..... the project uses a kinect 2 and oculus dk2.

    What I'm trying to accomplish is take the currently tracked pixels with the coordinate mapper from the kinect 2 and render them out as a pointcloud (works fine with setindices but too slow).

    It all works fine, just slow. I thought building on the gpu would help but it's being viewed through an oculus dk2 with 2 cameras, so I'm looking to have it in the scene....

    So ideally I have an array of 100k - 200k vector3 positions I'd love to draw but setindices was crawling with 15k points.
     
  4. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    So Whats the problem, its working in cameras...?
     
  5. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    Yes I need it in the scene, when you hold your hand in front of you with the VR headset...
     
  6. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    But sceneviews cease to exist when you make a build
     
  7. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    Yeah I need it for standalone windows 8. This is with setindices:


    There is other geometry that will be interacted with and multiple cameras. I have an array of vector3 positions from the depth sensor and rgb color for the points, just looking for something faster............


    Right now I'm working towards converting it to bytes and see if that helps. MemoryStream and BinaryFormatter classes.