Dot and Fresnel work on the angle between viewing vector and pixel’s normal. Which in case of a flat surface is identical. You’re looking for a difference in position. For plane it could be distance from center in X, and in Y, remapped to 0-1 range and multiplied one by another (to combine those masks). For a cube… well, that’s probably a matter of screen-space detection of distance to closest space outside of the cube. I have no idea how to approach the last one