Sorting error when baking displacement

There seems to be a sorting error when baking object displacement to an image. Look at this screenshot:


Why is object 3 (at the bottom) drawing over object 1 (at the top)? And why isn’t it drawing over object 2? Am I doing something wrong or is this a genuine bug?

Here’s the blend: bake_displacement.blend (205 KB)

Use the bias value to control the baking. A value of 1 should give the correct result

Thanks, that fixes the sorting. :slight_smile: But now the values are wrong:


Object 1 is only 40%. I need it up at 100%, like it was in the first image I posted (and like it is in the scene).

What is the Bias value doing anyway? I thought it adjusted the position of the bake “camera”.

I managed to fix this in Blender’s source code! :smiley: The problem was that the surface closest to the target object always won (which is desirable for AO but not displacement/normals). I’ve changed the logic so that the object above the plane always wins instead. I’ve also ensured that surfaces intersecting the plane/maxdist are picked up.