Simulating Stains

Stains are possibly the most difficult imperfections to simulate, beside scratches or breaks. This is due to the high variety of compositions that can be found for stains in the real world. Provided that the importance of this kind of imperfection is lower than for scratches or breaks, the method has been simplified a lot.

Stains appear on a part due to accumulations of different substances or materials over the surface, modifying the colour or reflection (BRDF) properties depending on their composition, like in the next part with some crossing stains over the surface:


Part 5036 stained


The first step to simulate stains is the definition of the stained zones over the part. This is done using the same idea as for scratches, using a pattern image mapped to the part surface. The pattern acts as a mask and is represented with grey tones, so the whiter is the pattern pixel the more stained is the surface point associated to this pixel. As with scratches, this pattern can be created using an image editor or painted directly onto the part surface, like in this case:

Stains painted over the surface


Once we have defined the stained zones the second step is the selection of the stain's material properties (BRDF). This selection is done empirically, without taking into account any kind of measure about the real composition of the stain due to its difficulty.

Finally, the resulting simulation obtained for the stained part above is shown in the next images:


Final simulation     Another point of view