Geometric recipe for superpotentials