Controlling Material Appearance by Examples

Yiwei Hu, Milos Hasan, Paul Guerrero, Holly E. Rushmeier, Valentin Deschaintre

TL;DR

This paper introduces a novel example-based material editing method that transfers fine-scale texture details from ordinary photographs onto existing 2D material maps. By optimizing within the latent space of a modified, tileable MaterialGAN using differentiable rendering, the approach enhances material realism while strictly preserving the original large-scale structure and tileability.

What Problem Does This Paper Address?

Creating realistic 3D virtual environments requires high-quality material maps that define how light interacts with a surface (e.g., diffuse albedo, normals, roughness, and specular albedo). However, editing these maps is notoriously difficult. Because the individual maps are highly correlated, using standard image editing tools like Photoshop often breaks their physical relationship, leading to unrealistic rendering or "baked-in" lighting artifacts.

While procedural material generation offers flexibility, it frequently looks synthetic or lacks fine-grained realism. The authors tackle the challenge of injecting real-world micro- and meso-scale details from a single target photograph into an existing material map without destroying its underlying structure or its ability to tile seamlessly across large surfaces.

Example of material appearance transfer on a full virtual scene.

Methods

The authors frame the appearance transfer as an optimization problem regularized by a generative adversarial network (GAN) prior. Their pipeline consists of several key components:

  1. Tileable MaterialGAN Prior: The authors modify the architecture of StyleGAN2-based MaterialGAN. Standard GANs introduce edge artifacts even when trained on tileable data. To fix this, they replace all convolutional and upsampling operations with circular padding, mathematically forcing the network to generate perfectly tileable material maps.
  2. Latent Space Optimization: Instead of optimizing pixels directly—which causes severe local minima and artifacting—they project the input material into the GAN's latent space ($W^+N$) and optimize the latent code $\theta$.
  3. Differentiable Rendering & Loss: A differentiable GGX shader renders the material under controlled lighting. The rendered image is compared against the target photograph using a specialized style loss.
  4. Resampled Sliced Wasserstein Loss: To enable spatial control (allowing users to mask specific regions for transfer), the authors introduce a uniform resampling strategy to the sliced Wasserstein loss. This allows the algorithm to compare deep feature distributions between regions with different pixel counts.
  5. Boundary Erosion: When using spatial masks, deep convolutional layers can "bleed" across boundaries. The authors apply an erosion operation to the masks, ensuring that the texture statistics are only computed from safely within the designated regions.
Comparison between per-pixel optimization and the proposed latent-space optimization.

Datasets

The MaterialGAN prior was trained on a synthetic material dataset containing 199,068 images with a resolution of 288x288 pixels, originally introduced by Deschaintre et al. [2018]. The evaluation was performed qualitatively using various real-world target photographs and procedural material inputs. No new benchmarks were introduced.

Key Insights and Ideas

  • The Power of the Prior: Per-pixel optimization fails because it doesn't understand what makes a material "realistic." Constraining the optimization to the latent space of a pre-trained GAN ensures the generated maps (albedo, normal, roughness) remain physically plausible and properly correlated.
  • Enforcing Tileability Architecturally: You cannot simply tell a network to make something tileable; edge artifacts naturally emerge from standard padding. Circular padding natively embeds the tileability constraint into the generator's weights.
  • Handling Distribution Mismatches: Standard optimal transport losses break down when comparing masks of different shapes and sizes. Uniformly resampling the larger pixel distribution solves this, unlocking multi-target blending capabilities.
Multi-target transfer using binary masks to guide specific texture regions.

Key Results

  • Performance: The optimization is highly efficient, running on an NVIDIA RTX 3090. The projection step takes roughly 5 minutes (1000 iterations), and the appearance transfer takes about 2.5 minutes (500 iterations).
  • Qualitative Quality: The method successfully avoids the local minima and "baked-in" lighting artifacts that plague per-pixel optimization and Deep Image Prior baselines. It successfully transfers complex details, such as injecting leather grain into a quilted cushion or realistic brick textures into a plain, synthetic wall map, all while maintaining perfect tileability.

Limitations and Future Work

  • Resolution Limits: The method is bound by the fixed resolution of the underlying MaterialGAN. While StyleGAN architectures scale well up to 1K resolution, they do not yet natively support the super-high-resolution textures (4K to 8K) required by high-end film and game productions.
  • Material Constraints: The framework relies on a Cook-Torrance-like material representation, limiting its application to opaque surfaces. It cannot currently handle complex material effects like translucency, subsurface scattering, or cloth anisotropy.
  • Conflicting Properties: If the source material and target photo have strongly conflicting properties (e.g., trying to map a rough marble texture onto a highly metallic surface), the optimization tends to blend the parameters awkwardly rather than making an intelligent stylistic choice.

Summary updated

BibTeX
@article{hu2022controlling,
  author = {Yiwei Hu and Milos Hasan and Paul Guerrero and Holly E. Rushmeier and Valentin Deschaintre},
  title = {{Controlling Material Appearance by Examples}},
  journal = {Computer Graphics Forum},
  year = {2022},
  url = {https://openreview.net/forum?id=LBkmc1BXvy},
}
Figure