8

Struggling to work out how to make a depth AND height pass, so I can use them in compositing an animation of a city.

Depth is easy...height, not so...

Is there some way to mix a vertical gradient with a mist pass to get this result? Or is there a different way?

I am trying to get the effect of a denser mist at lower levels.

Let me know if i need to clarify further.

user3471
  • 199
  • 1
  • 4

1 Answers1

9

Basic idea : render additional layer with overriding material which assign a grayscale value based on the point height , use this layer as height pass

Details :

create the overriding material that will replace all materials in the height pass as follows :

enter image description here

setup an the height pass to use the override material :

enter image description here

in the compositor use the color output of the Height layer as a height pass :

enter image description here

after compositing here is the result :
no height :
enter image description here with height :
enter image description here

Chebhou
  • 19,533
  • 51
  • 98
  • thanks thats looks interesting, guessing I can swap the math for a colour ramp, will give this a try. – user3471 Apr 20 '15 at 19:02
  • @user3471 I guess you can , also there is a map value node you can use – Chebhou Apr 20 '15 at 19:39
  • Having trouble mixing this with my mist pass than I am using for depth.What I need to do is only have mist at far and low levels, however when try to mix the height map and depth I get the mist at the front not back.Maybe i should be using an transparent material instead of the black? – user3471 Apr 21 '15 at 06:35
  • @user3471 so you mean no gradient mist (constant from depth a to b ) along the depth ? – Chebhou Apr 21 '15 at 08:42
  • 1
    I think i may have figured it now. Because the gradient for the height is on the actually meshes unlike the z-dpeth or mist pass it does not effect the sky or background. This was creating a weird effect when mixing the height layer with my mist pass.So on the height layer i added an alpha over node with a white background and this seems to work. – user3471 Apr 21 '15 at 10:08
  • @user3471 glad you solved this , I didn't realize that ( my test file is too simple ) feel free to edit my post to include this solution – Chebhou Apr 21 '15 at 10:19