How To ... Access the Z-Depth channel
delete $VoxelBox*
rbmp = render outputsize:[32,32] channels:#(#zdepth) vfb: off
z_d = getchannelasmask rbmp #zdepth
progressstart "Rendering Voxels..."
for y = 1 to rbmp.height do
(
progressupdate (100.0 * y / rbmp.height)
pixel_line = getpixels rbmp [0,y-1] rbmp.width
z_line = getpixels z_d [0,y-1] rbmp.width
for x = 1 to rbmp.width do
(
b = box width:10 length:10 height:(z_line[x].value/2)
b.pos = [x*10,-y*10,0]
b.wirecolor = pixel_line[x]
b.name = uniquename "VoxelBox"
) --end x loop
) --end y loop
progressend ()
Z-Depth通道访问
本文介绍了一种通过渲染输出尺寸及Z-Depth通道获取并处理三维空间信息的方法。该过程涉及渲染设置、逐像素读取Z-Depth值,并将这些值转化为具体的三维对象。通过对每个像素对应的深度值进行解析,可以构建出相应的三维模型。
929

被折叠的 条评论
为什么被折叠?



