Jump to content

Point Clouds - Vector Point Rendering?


rjmelter
 Share

Go to solution Solved by Josh,

Recommended Posts

I will add this in an update to Ultra Engine 1.0.2 this week. It won't be difficult. Vertex colors are supported.

I'm assuming this will be just one big mesh with millions of vertices. I honestly don't know if Ultra Engine will be much faster than Unity in this situation, because the bottleneck will probably be the vertex pipeline, and both engines are probably running at the hardware's max speed under those conditions.

This is actually the exact reason why I keep telling everyone it is important to keep the vertex structure as compact as possible:

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Do you know what the text info means? I am guessing it's vertex position / RGB color / some other info I don't know:

-1.38699996 -5.33300018 0.15500000 0 36 218 -2032.000000 9.000000 9.000000 9.000000 9.000000
-1.88900006 -5.35699987 0.19300000 0 44 210 -1991.000000 9.000000 9.000000 9.000000 9.000000
-2.05200005 -5.37300014 0.22499999 0 52 202 -1982.000000 9.000000 9.000000 9.000000 9.000000
-2.07200003 -5.36299992 0.22300000 0 51 203 -1975.000000 9.000000 9.000000 9.000000 9.000000
-2.06599998 -5.36199999 0.22400001 0 51 203 -1973.000000 9.000000 9.000000 9.000000 9.000000
-2.10800004 -5.36899996 0.22300000 0 51 203 -1988.000000 9.000000 9.000000 9.000000 9.000000
-2.09500003 -5.37099981 0.22600000 0 52 202 -1979.000000 9.000000 9.000000 9.000000 9.000000
-2.08899999 -5.36800003 0.22499999 0 52 202 -1976.000000 9.000000 9.000000 9.000000 9.000000
-2.12100005 -5.36299992 0.22499999 0 52 202 -1996.000000 9.000000 9.000000 9.000000 9.000000

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I was able to load your text file, but I am getting this Vulkan validation error:

Quote

Validation Error: [ VUID-VkGraphicsPipelineCreateInfo-Vertex-07722 ] Object 0: handle = 0x3f36830000000078, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x5e7d87fa | vkCreateGraphicsPipelines(): Pipeline topology is set to VK_PRIMITIVE_TOPOLOGY_POINT_LIST, but PointSize is not written in the Vertex shader. The Vulkan spec states: If the pipeline is being created with a Vertex {ExecutionModel} and no TessellationEvaluation or Geometry {ExecutionModel}, and the topology member of pInputAssembly is VK_PRIMITIVE_TOPOLOGY_POINT_LIST, a PointSize decorated variable must be written to (https://vulkan.lunarg.com/doc/view/1.3.236.0/windows/1.3-extensions/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-Vertex-07722)

So I will need to muck around in Vulkan a bit more before it works.

I actually thought point sizes had vanished from the pages of history.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

Here's a first pass at this. Point cloud meshes don't need an indice array, so I need to go in and figure out how to get rid of that when MESH_POINTS is used, as it will be more optimal without that.

image.thumb.png.1d925b9d9870c356eaa6ee38fce5ab96.png

The vertex structure also includes a lot of data a point cloud does not use, like texture coordinates and normals, so maybe I can create a special optimized vertex buffer just for point cloud rendering. It would make a significant difference in speed, as LIDAR data is one of the rare cases where the vertex pipeline actually is the bottleneck.

  • Like 3

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

This is the code I used to load that...

#include "UltraEngine.h"
#include "ComponentSystem.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();
    world->SetAmbientLight(0);

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    
    world->SetAmbientLight(1);

    //Camera controls
    auto actor = CreateActor(camera);
    actor->AddComponent<CameraControls>();

    auto stream = ReadFile(GetPath(PATH_DESKTOP) + "/T1.txt");

    auto model = CreateModel(world);
    auto mesh = model->AddMesh(MESH_POINTS);
    while (not stream->Eof())
    {
        auto s = stream->ReadLine().Trim();
        if (s.empty()) continue;
        auto sarr = s.Split("");
        if (sarr.size() < 6) continue;
        auto v = mesh->AddVertex(sarr[0].ToFloat(), sarr[2].ToFloat(), sarr[1].ToFloat());
        mesh->SetVertexColor(v, sarr[3].ToFloat() / 255.0f, sarr[4].ToFloat() / 255.0f, sarr[5].ToFloat() / 255.0f);
    }
    model->UpdateBounds(BOUNDS_ALL);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Oh boy...I will check it out tomorrow. I need to change your password so I can log into your account in the client. Is that okay?

The point rendering also is not available yet. I'll publish the update for that tomorrow. I don't recommend messing around with shaders yourself unless you want to. I think I can make a special shader family just for rendering point clouds, with almost everything stripped out of it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

An update is now available in the 1.0.2 channel. You must also sync your project files to get some updated shader binaries.

Loading 2 million vertices from a text file is very slow, especially in debug builds, so you definitely will want to load this type of data from some binary format.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Mesh construction will be much faster if you create an STL vector for the vertices, and another for the indices, get the total size for each, resize them, and then fill them in. Then use the CreateMesh() overload that accepts the data:
https://www.ultraengine.com/learn/CreateMesh?lang=cpp

That will be much much faster than adding one vertex at a time.

Regarding VR, although it is very important I decided it would be okay to defer that for now because everyone is still just learning the new engine. When I add support, it will take less than four weeks to do. In Leadwerks I was using the SteamVR library, and it Ultra I can using Khronos OpenVR. I don't think it will be much different than what I did before. I don't really recommend trying to hack VR support right now because anything you do will just get replaced by something that will probably be better integrated. I have a meeting this week that will give me a better idea of what the immediate next steps will be, but I don't have a definitive answer about the VR question today.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 1 year later...

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.

 Share

×
×
  • Create New...