Rework algorithm to use same approach as points displacement renderer. Also maintain Z/M values, and add tests and docs.