• Welcome to the new Community Forums at HiveWire 3D! Please note that for security purposes our store and forum are on two separate servers so you will require a separate login for each. The store will ask you for your Real Name (WILL NOT BE displayed to the public) and the forum will ask you for a User Name (WILL BE displayed to the public). You may use the same email address and password for both.
  • We are having some issues with our customized styles. The forum will be open with the default style until we can correct the issues. Thank you for your patience.

Easy Shader For Creating A Height Map Render Of Your Scene

Very simple shader that'll give you a height map (as opposed to depth map) render of your scene, with everythink at ground level or below (Y coordinate zero or negative) rendering black, and anything above ground level rendering in a height-dependent shade of grey,with the height for white being a parameter in the shader. If it's not one of bagginsbill's it's inspired by him.


You don't need to turn lights off or adjust anything else, just set the material as shown and render.
Using a height map render (possibly in conjunction with a depth map render) in postwork opens up a new world of ground-foggy possibilities...
Just as a cross-reference, I posted a year ago on the Renderosity "How Do You Use The Poser Atmosphere ?" thread about a couple of methods of doing a DEPTH-map render for anybody who's not clear on that (in PP2014 you can do an automatic depth-map using Render > Render Settings > Auxiliary Render Data (at the bottom of the right hand 'Options' pane) and ticking 'Z Depth'. When you save your render, an additional image will be saved with the same name plus a ' Z' suffix - that's your matching depth map!)

My HEIGHT-map shader above is indeed based on (i.e. a shameless rip-off of! ;o) ) bagginsbill's DEPTH-map shader, as implemented by Miss Nancy here*

*that DEPTH-map shader is, I believe, only intended for use when rendering from the FRONT camera (I think the problem they were working on was creating bump/displacement maps from a render). Since the P-node is in WORLD coordinates the shader will ONLY work if the camera's Z-axis is parallel to the world Z-axis. But for a HEIGHT map we want the Y value from the P node regardless of our camera's position and orientation.
Back to the height-map shader - here's a simple way to use it. I loaded my main render into GIMP, then created a new solid white layer (my fog). I added an alpha mask to this fog layer and loaded my height-map render into the alpha mask. I then inverted the colors of the mask:
And then doing a similar with with the depth-map render as well (i.e. adding another white layer and using the inverted depth-map render as a layer mask):