I have a new requirement which is to integrate a heatmap for my current project that will support upwards to 1 million data points and project it on my terrain mesh.
I've read this post: https://www.alanzucconi.com/2016/01/27/arrays-shaders-heatmaps-in-unity3d/ and tried to implement it which after some tinkering was a success. The tinkering part was changing:
uniform float3 _Points [100]; // The positions (x,y,z)
uniform float2 _Properties [100] // The properties (x = radius, y = intensity)
to
uniform float4 _Points [100]; // The positions (x,y,z)
uniform float4 _Properties [100] // The properties (x = radius, y = intensity)
along with some tweaks to the script. I've managed to project upwards to 100 random points and the heatmap was rendered correctly. After I've cranked up the numbers, my FPS started to deteriorate dramatically and finally I've ran into the issue where I'm not allowed to have more than 1023 data points after which my shader crashes. Note that although I'm projecting my heatmap onto a 3D mesh I'm only using two data points (X,Z) as the end result should be a 2D heatmap.
How can I tackle this (for me) monstrosity of a task as 1023 points seems way too far from 1 milion so I presume I'm doing it very inefficiently.
In addition, this project has to run cross platform on Windows, Mac and Linux therefore I'd prefer OpenGL as renderer.
You could divide the mesh you are rendering to into multiple meshes and pass to each one the points that should stay in that portion of the map. This way you can work around the limit of uniforms you have with a single mesh. I've worked with basically the same shader you are using, I would actually like to use a computer shader to pass more data but I'm no expert in that and for now I'll have to go with my solution.