1. An X-ray diffraction method of mapping grain structures in a crystalline material sample, where an X-ray source provides a polychromatic X-ray beam in a beam path, in which beam path the polychromatic X-ray beam is divergent, a staging device positions the crystalline material sample in the beam path, an X-ray detector detects a plurality of diffracted X-ray beams leaving the crystalline material sample, and wherein the crystalline material sample is a polycrystalline material sample having a plurality of grains, the staging device locates the polycrystalline material sample in a plurality of mutually different angular positions in relation to the X-ray source, the X-ray detector detects spots or line-shaped segments from beams diffracted from at least some of the grains, each spot having a position and each line-shaped segment having a position and a length, a processing device analyses values received from the X-ray detector and utilizes at least the positions of the spots or line-shaped segments when determining a three-dimensional model of the polycrystalline material sample, and wherein the processing device discretizes an initial three-dimensional model of the polycrystalline material sample into voxels and reconstructs the grains in the model by iterative testing associating crystallographic orientations of the voxels to the detected spots or line-shaped segments.