The hardness of materials plays an important role in material design. There are numerous experimental methods for measuring the hardness of materials, but theoretical prediction of hardness is challenging. By studying the correlation between hardness and the elastic properties of materials, namely shear and bulk moduli, the pressure derivative of the bulk modulus, we have constructed a simple and physically intuitive hardness model. By introducing the spatial variation of the shear modulus, it is possible to predict the hardness anisotropy of materials to define the minimum and maximum values of hardness possessed by a given material. Furthermore, by using the equation of states to define the pressure derivative of the bulk modulus, it is possible to determine the temperature dependence of hardness for given materials. All quantities in the model can be obtained directly from accurate first-principles calculations or from experiments, making it suitable for practical applications.