Better use of viewport ZBuffer functionality please


I find the current state of ShowZBuffer a kind of ‘tease’ command that lets me imagine and wish for a whole range of good uses but none of them is possible now due to one limitation.
We would like to be able to set the Min-Max distance range for camera, and not one that is currently based on varying view objects scene bounding box. That would turn it into a really useful one. If making UI for it is too much, maybe a simple command line input for distance range would do? @jeff - is that control already possible but not exposed with the display pipeline?

Having that implemented I would also expect the larger-than-screen screencaptures on ZBuffer would be no longer ‘tiled’ as it currently is.

In a long run I also wish for a ‘fog’ addition for display modes - overlaying Zbuffer depth on regular display for better depth perception. Very common in various 3D software packages.



Hi @Jarek,

No control exists to adjust the physical near and far clipping planes…It’s been on the todo list for a long time but just hasn’t found its way to the top… However, I don’t believe this will fix any of the tiling seams…but maybe…won’t really know until it’s tried. I’ve already got in place a way to tell Rhino what the near and far values are (which was an attempt to fix the tiling seams), but it didn’t work. Apparently even having two adjacent viewports using the exact same near and far values still does not generate the exact same z-values along the seam(s).

It was not my intention to “tease” anyone with the ShowZBuffer command…It started out as a debugging tool I made and used when working on the real time shadows architecture…Somehow the test command got leaked, which eventually caused it to become a real command due to its popularity. My point? It’s initial design was for viewport only, WYSIWYG output, and it was never meant to be used to capture huge (larger than physical monitor size) resolutions. In order to do that, I think a completely new, more robust design is in order.


Hi @jeff,

Thanks for the explanation. If you already have the min-max control working, it would be fantastic to have it exposed in some way, even crude testcommand,… before more fancy UI and more controls come along. We would make use of it daily! With 4K monitors you can get nice results just with screen-size screenshots…

For the larger-than-screen viewcaptures tiling - sounds odd that this does not fix it but obviously it all depends on how the captures are created ‘under the hood’. I guess the camera is moving in original camera plane to cover each ‘tile’ of the hi-res screen. In that case, if min-max zbuffer is calculated as distance from camera point, then we would get tiling. But if it is calculated as distance from ‘camera plane’ then it should not (if camera moves only within its plane). I may be totally wrong on this one ; )

In a long run, do you see any chance of having a ‘fog’ as a part of the display mode settings ? (with control of color, intensity and min-max distance…)



1 Like

Is there a way to do this yet (set min/max?)? As a workaround I can of course just scale something in Z, for the time being, with the help of some other topics for constraining a square viewport and SetZoomExtentsBorder to 1 in parallel, I can get a nice result. With some help from Illustrator.

I’ve made a little command that can help you achieve part of what you’re looking for:

ZBuffer.rhp (43.5 KB)

Will it work with WiP?

Yes, It works.

Hi @Mahdiyar,

Thanks for sharing the plugin - looks interesting but on my end (Rhino 6 latest SR) it doesn’t work.
The command runs but nothing happens. Is there anything to try to make it work?
Does your plugin allow for high-resolution Zbuffer captures?

Also I am curious how did you make it work, are you using any of this:



  • Sorry to hear that I’m not sure what the problem is. I’m using Rhino 6 latest SR too.
  • unfortunately no.
  • Yes, I’m using ‘ZBufferCapture’ class. if you’re interested here I’ve attached my code. (5.8 MB)

Hi @Mahdiyar,

thanks for sharing your plugin code! I only do scripting but should be able to distill how you are using the ZBuffer Min-Max settings from there. Very helpful…

Would you ever consider adding custom-resolution zbuffer captures to your plugin ?



Hi @jeff Jeff, would you consider exposing the Min-Max settings for ZBuffer, even as a test command, in V7? Being able to control this along with hi-res ZBuffer captures that now work without tiling effect would be very powerful.


Is there a YT feature request for being able to set min/max ZBuffer? Similar to the plugin but built in?

The only one I know of is this:
Fog directly in viewport : RH-50893 (

It’s still a command I think could get improved so much. Very kind of trial and error. Setting black and white point would be great with, say, drawing a line.

I just want to use it for making nice tileable height maps from small sections of texture. I wondered if clipping plane might’ve helped. Weirdly if you select he clipping plane it makes this sort of lighter square which is the size of the clipping plane.


I agree, the min-max distance control has been asked for by many users for a long time. I still hope we can get there, maybe exposing these options in the _ShowZBuffer command? @Jeff mentioned before that these controls are there, just not exposed I think.
Other than the general “Fog” YT request, that would be much more involved task to implement with UI etc., there is no YT item for allowing min-max ZBuffer control in the viewport.


Even just command line would be okay as a start. Looking again, adding the clipping plane in is kind of a nice workaround actually for now. Minus the oddity with the brightened area when you select it.

I had mixed luck with the clippingplanes. It is inconsistent and still lacks the precise control over the depth boundaries.
One hack method you can try is to make an array of 100 planes with full white (or black) material at 99% transparency aligned to the view camera plane. By scaling the array of planes 1D you can get pretty close to good fog effect. That combined with an All-Black display mode for geometry (planes need a per-object display mode override) is a poor-man’s version of the ZBuffer control :wink:

Not sure why I’m tagged here, this is something for @jeff .

Probably because you creted the YT item

Right, “luckily” I’m not the assignee :wink: