Point cloud to depth map

Hello. It’s my first time using TD and I could use some pointers.
I have a 3D point cloud (geo COMP, or CHOP with x|y|z) and I’d like to transform that into a image I can then use for blob tracking.
What’s the best way to go from 3D to a depth map?
Thanks!

For a depth map you’d just only use the B channel (Z). You can use a Reorder TOP to make it a single channel and move the B into the output channel.

Thank you, but then I’d lose the x/y information of those 3D points. They are not cleanly distributed so that there’s 1 point per x/y grid square, it’s a random cloud.

I went with an [Execute] DAT. That’s the code, if anyone is interested:

# me - this DAT

IN = op('clean3D') 
OUT = op('depthmap')

minX = -8
maxX = 8
minY = -0.7
maxY = 0.7
minZ = 0.9
maxZ = 3.2

def onFrameStart(frame):

	for i in range(OUT.numRows):
		for j in range(OUT.numCols):
			OUT[i,j] = 0

	for dot in range (IN.numRows):
		x = IN[dot,0]*-1
		y = IN[dot,1]*-1
		z = IN[dot,2]

		position_x = int(( x-minX)*(OUT.numCols)/(maxX-minX))
		position_y = int(( y-minY)*(OUT.numRows)/(maxY-minY))

		depth_value = (z-minZ) / (maxZ-minZ)
		if depth_value < 0:
			depth_value = 0
		if depth_value > 1:
			depth_value = 1

		# only output to OUT if within bounds
		if position_x >= 0 and position_x < OUT.numCols:
			if position_y >= 0 and position_y < OUT.numRows:
				# only write if lower than existing value
				current_value = OUT[position_y,position_x]
				if depth_value > current_value:
					OUT[position_y,position_x] = depth_value 
	return