From LiDAR data I have separated ground and non-ground points with PMF. Now I want to flatten all the ground points (z = 0) but keep the distance above the ground for all non-ground points. This can be done in LASTools with LASground -replace_z.
The wanted result is shown in the image below.
basically you want to "normalize" the terrain Z value to the ground surface. You create a ground model using your ground points - for example a grid with cells - aka raster - holding an interpolated value of the ground Z value, and then subtracting all the points to that value. Just build a grid over your XY bounding box; below an example of a 90 X 100 grid:
Then you assign each of your ground point to a cell using its coordinate and cell resolution.
By the way, in LasTools this is possible to the "lasheight" module, if you do some Googleing you will read about how it works.