Shanghai Jiao Tong's PolyCrysDiff Generates Simulation-Ready 3D Metal Microstructures on Demand
A conditional latent diffusion model builds 3D grain structures with tunable size and shape, then feeds them straight into physics simulators for tensile testing.
ProTakeaways
- PolyCrysDiff adapts latent diffusion to generate 3D polycrystalline microstructures at (64,64,64) voxels with RGB-encoded orientations. Paper
- Conditional generation on grain count and sphericity hits R squared above 0.972, with grain count reaching 0.995.
- Uses a 3D VAE plus 3D U-Net with cross-attention conditioning, trained on 2000 Voronoi samples on a single RTX 4090.
- Beats MRF and SolidTexture baselines, which fail to produce distinct grains or lose crystallographic orientations entirely.
- Generated volumes are directly meshable and were validated via CPFEM tensile simulations in the MOOSE framework.
- Case study recovers Hall-Petch behavior: finer grain structures show higher tensile strength (552.6 vs 548.0 MPa).
Designing better metals, ceramics, and alloys usually comes down to controlling what happens at the grain level. The three dimensional arrangement of crystal grains determines how a material bends, cracks, or holds up under load, but generating realistic 3D grain structures on demand has been a persistent bottleneck. A new framework called PolyCrysDiff from Shanghai Jiao Tong University takes a swing at this problem by adapting the conditional latent diffusion recipe behind Stable Diffusion to the world of polycrystalline microstructures.
The pitch is straightforward: give the model a target grain size or sphericity, and it produces a voxelized 3D crystal structure that is not only visually convincing but also directly usable in downstream physics simulations. The team reports an R squared above 0.972 when controlling grain attributes, and they close the loop by running crystal plasticity finite element simulations on the generated volumes to predict tensile behavior.
Why grain generation is stuck
Polycrystalline materials are aggregates of many small crystals, each with its own orientation. Accurate micromechanical simulation of polycrystalline materials requires a realistic digital representation of the grain scale microstructure, and generative diffusion models have recently been used for synthesizing polycrystalline realizations. The catch is that experimentally reconstructing real 3D grain structures via serial sectioning or X-ray computed tomography is slow and expensive, so most researchers fall back on synthetic generators.
The workhorse tools, Neper and Dream.3D, rely on Voronoi or Laguerre-Voronoi tessellations. These methods let you control grain size and shape and model 3D grain boundaries with specified thickness, and the grain-size distribution can be fitted to a lognormal rather than the normal distribution typical of plain Voronoi tessellations. They are fast, but geometrically rigid, and they struggle to reproduce the irregular morphologies seen in real materials.
Machine learning alternatives have their own problems. Markov Random Field methods stitch 3D volumes from 2D exemplars by matching local voxel neighborhoods, but they are compute heavy and often produce blurry grain boundaries. CNN-based texture synthesis models like SolidTextureNet and GramGAN optimize a VGG perceptual loss between slices of the generated volume and reference images, but because they never explicitly learn 3D spatial dependencies, the resulting grains tend to be topologically incoherent.
The recipe under the hood
PolyCrysDiff represents each microstructure as a 64 by 64 by 64 voxel grid, where each voxel carries an RGB value that encodes its crystallographic orientation, similar to an electron backscatter diffraction map. That trick means grain boundaries and orientation gradients are baked into the color channels.

The pipeline follows the Latent Diffusion Model template, extended to volumetric data. It has three stages:
- A 3D variational autoencoder compresses the (64, 64, 64, 3) voxel volume into a compact (16, 16, 16) latent tensor. Every 2D convolution in the standard VAE is swapped for a 3D convolution.
- A 3D U-Net acts as the denoiser inside that latent space, trained with a linear noise schedule over 1000 timesteps to predict the noise added at each step.
- Conditioning inputs, such as grain count or mean sphericity, are pushed through a linear encoder and injected via cross-attention layers in the U-Net, mirroring how text prompts steer image diffusion.
Training used 2000 Voronoi-generated samples per dataset, with grain counts sampled between 50 and 300 per volume. Ten fixed RGB values represent discrete crystallographic directions, and a greedy graph coloring keeps adjacent grains distinguishable. The VAE trained for about 19 hours and the diffusion model for around 70 hours on a single RTX 4090.
How well does it hit the target?
The unconditional model reproduces the training distribution closely. Kolmogorov-Smirnov distances between generated and reference distributions land between 0.036 and 0.086 for grain size, aspect ratio, and sphericity, with Earth Mover's Distances in the 0.005 to 0.018 range. VGG perceptual similarity between slices lines up too, with a KS of 0.028.
The more interesting numbers show up in the conditional experiments. When asked to hit a specific total grain count between 50 and 300, PolyCrysDiff produces structures whose actual grain counts correlate with the target at R squared = 0.995. Sphericity control is nearly as tight, and repeated sampling at the same condition gives tightly clustered outputs, so the control is stable and repeatable rather than a lucky one-off.

Against the baselines, the contrast is stark. MRF outputs tend to smear voxels of the same orientation into chaotic blobs where individual grains cannot be segmented. SolidTexture drops entire orientations from the output and fails to build coherent 3D grains. This matters because if you cannot cleanly identify grains, you cannot mesh the structure for a physics solver.
Closing the loop with physics
The paper's most useful contribution may be showing that the generated volumes are actually simulation ready. The team meshes the PolyCrysDiff outputs and runs crystal plasticity finite element method (CPFEM) simulations in the MOOSE framework, modeling Al7075-T6 aluminum under 5 percent uniaxial tensile strain. Cubic elastic constants are set to C11 = 107.3 GPa, C12 = 60.9 GPa, and C44 = 28.3 GPa.
As a demonstration, they generated 50 structures at a mean grain size of 7.94 micrometers (125 grains) and another 50 at 6.30 micrometers (250 grains), then compared tensile strength distributions. The finer-grained set averaged 552.6 MPa versus 548.0 MPa for the coarser set, recovering the well-known Hall-Petch trend where smaller grains yield stronger materials. That is a modest quantitative difference, but it confirms the generated microstructures behave physically the way real ones do.

Where it fits and where it does not
This is a useful tool for anyone running structure-property studies who currently spends time hand-tuning Voronoi generators or fighting with MRF outputs. The controllable conditioning means you can sweep grain size or sphericity systematically, generate ensembles, and feed them directly into finite element solvers without the usual meshing headaches from ill-defined boundaries.
The limitations are worth naming. Training data comes from Voronoi tessellations, not real experimental scans, so the model inherits whatever bias Voronoi has toward equiaxed grains. Conditioning is currently limited to scalar descriptors like mean grain size and sphericity; richer inputs like full distributions, images, or text prompts are flagged as future work. And the (64, 64, 64) volume with 10 discrete orientations is a fairly coarse representation compared to what a materials scientist might want for a production simulation.
The code and model weights are not linked from the paper itself. Data is described as available on request from the corresponding author. That will limit immediate adoption, but the architecture is essentially Stable Diffusion with 3D convolutions and simple scalar conditioning, so reproducing it is well within reach for anyone with a 4090 and a Voronoi generator. For teams already building generative pipelines for materials, this is a solid template for extending latent diffusion into the polycrystalline domain.