Refining the optical mouse idea, it is much simpler to use a strip of textured plastic about 1/2 inches wide, 1/10 inch thick and an appropriate length. Attach this to a small polystyrene float. Mount the mouse circuitry in a static position at the top of the tank, so that the float strip moves paste the mouse window (feed the strip thru a slot by the mouse read window), as the depth in the tank increases. This would definitely work and give excellent Z resolution at a very cheap price.