Generate depth value for little performance cost instead of reading it from db