World Position MIST PASS

I want to composite 2d elements in a 3d scene. To do this I can use the mist pass to mask objects that are in front of the 2d elements in compositing. This works great unless the camera is moving in which case the mist pass moves.

A way to solve this is to animate the mist pass in the world settings, but this seems to require a bit of guesswork as you can’t see the in and outs from the viewport.

My question is:
Is it possible to have a mist pass that is stationary in the world (i.e doesn’t change with camera distance)?

Maybe world position can do the same thing?

Any help would be great :slight_smile:

But the mist pass is giving you the distance to camera (with range change) and you use this for compositing
(behind or before other objects by greater than… ). Then why is this a problem ? On the other hand if your scene is set according to the global axis then you can use use a AOV output node to get the object info location ( ar additionally minus the texture coordinate ?) to use this info.

(behind or before other objects by greater than… ).

I am not sure what you mean by this. Is there a way to change the mist past based on an object?
Would the AOV node work similar to a cryptomatte, I have no clue what the AOV output node does. According to docs you can output custom passes, but with shaders? I don’t think this would help with my issue…

It would be great, for example, if you could set the mist pass to start and end with certain objects.

Thanks for the help!

So the objects are placed in different distances to the camera and if its greater then something then it’s behind thats thing.
If the camera rotates arround a point in the scen thsi should not be a problem but if you zoom in the values in you conpositing have to change.

Maybe we don’t know all your wishes.
An absolute mist cane be easily done if orientated along a standard axis (x for example) but you get into trouble if the camera rotates…

Thank you soo much for your help Okidoki, this suggestion is very helpful, quite similar to the world position. I think what I am asking isn’t possible in blender without animating something. I did find somewhat of a solution, by using random per island output from the geometry node, to give everything a different value. This isn’t the most ideal solution, so I may end up just animating a mist pass in a duplicate scene or exporting a black and white aov pass where every foreground object is white and background object is black. Still the mist pass might be the best option as it also takes into account differences in the same geometry.

Anyway, thanks so much for the help, I have definitely learnt something :slight_smile: