The lack of continuity conditions of the rock materials presents a serious challenge for the continuum mechanics approach, hindering the effective use of the well-established methods such as the finite element method and the boundary element methods. In the presented paper a discrete technique based on molecular dynamics approach is used for computer constructing of polycrystal materials. On the first step material grains are obtained from condensation of vaporised mixture of particles. Then the grains are compressed to obtain the material with the desirable porosity. Another variant for obtaining polycrystals is melting of the grain mixture with the consequent cooling. Uniaxial compressive loading tests for the obtained computer materials are presented, where the stress-strain relationships for mono and polycrystal specimens are compared. Influence of porosity on elastic and strength properties of the material is investigated. Applications for sandstone materials with different porosity are considered. Use of the described technique for simulation of percussive drilling in hard rock formations is discussed.