Since Siggraph we have wanted to highlight the great work in V-Ray regarding an age old computer graphics problem. One that has remained remarkably resistant to the best efforts of the world's render experts to solve.

Materials such as snow, sand, metallic paints, rough plastics, and metals often exhibit a bright sparkling or glittering surface feature, as anyone who has rendered a metallic paint 3D car will know. These features can catch the light and vary based on your orientation to the surface and the light sources. Having this characteristic spec ping can make a huge difference to how an audience perceives a material.

Microfacet-based surface models, composed of a large ﬁnite number of microscopic mirror-like ﬂakes, can mimic this effect. Until recently V-Ray had a special metal car paint shader to emulate this effect. The broader problem is due to the averaging of normals that is a very wide spread problem in computer graphics. To get car paint to hold up as you moved away from the car, the team at Chaos previously had to implement a very special internal workaround that meant that this part of the V-Ray renderer ran many times slower than a similar setup without the special shader. It worked very effectively for car paint and without it the spec sparkling would effectively average out as you pulled back, but it was costly.

The bigger, broader problem is not just a car paint problem, although V-Ray's solution was specific to car paint. The problem itself is the same one that makes a backlit lake of water or even an orange look 'plastic' as it moves away from the lens. Even human skin looked more plastic the further away from the camera it went. This was something the vfx team on the original Matrix films worked out years ago, yet the problem has remained extremely hard to solve.

Recently the team at Chaos Group released a version of V-Ray that partly solves this. Their solution is a new microfacet BRDF and a memory-efﬁcient stochastic algorithm that inherits the good properties of previous work, but does not require any precomputation; it implements optimal importance sampling which is extended to efﬁciently sample wide and heavy-tailed microfacet distributions (i.e. GGX), and offers better overall performance. In addition, a triplanar mapping technique is employed to handle geometry without texture coordinates. The algorithm is both practical and easier to implement.

The method works by assuming that there are N ﬂakes that are uniformly distributed in a unit of texture space and their normals follow a micro-facet distribution on that unit’s rendering or lighting equation hemisphere. The multiscale BRDF is deﬁned as the microfacet BRDF, averaged over a ﬁnite surface area. In the implementation, the algorithm works with a patch or parallelogram approximation of the pixel footprint. Into this mix goes more complex techniques such as caching, overlapping sampling of the parallelograms and optimal Importance Sampling. A key advantage of the algorithm is that the ﬂakes are not stored in memory, but their counts in this patch are reproduced by a deterministically seeded stochastic process.

The broader issue, beyond this type of rendering, is that fine surface detail in a MIP map or texture solution no longer produces or rather maintains the micro varying normal differences and the resultant normal of a tiny cluster of diverging normals is averaged to look very much like a flat surface. While your eye can't see this detail, your eye can easily see the big specular highlight on the surface, unlike reality where this should be broken up with all that underlying variation. The computer spec highlight version produces a more uniform 'plastic-smooth' specular highlight. One reads this big uniform highlight as being made on a surface of a smooth object and thus a face or lake or car looks plastic while in reality if you get much closer, this combining/averaging of surface normals is no longer happening and the surface looks correct.

The V-Ray solution is not a normal map solution. It is a specialist solution for the flecks that exhibit a very similar problem. The V-Ray solution directly solves the flake problem, not the general problem, but without this flake solution the car paint problem appears to be the same for the user, namely: the loss of disrupted specular pings or highlights.

The V-Ray 3.4 *VRayStochasticFlakesMtl* material can be used to simulate car paints, snow and other glittery materials. It works by simulating at render time the aggregated effect of a large number of mirror-like flakes scattered over the surface of an object, with the 'averaging out effect' seen in prior methods. The material is somewhat similar to the VRayFlakesMtl and VRayCarPaintMtl materials, but uses less memory and avoids the tiling issues for these materials.

The effect was first shown in June with this early test:

Vladimir Koylazov (Vlado) posted this early test (above) on YouTube a few months ago, since then the technique has improved further. He stated that they had implemented the "material based on a paper from 2014 Siggraph. It turned out that quite a few changes are needed to make the algorithm usable in practice."

The new V-Ray algorithm by Chaos Group was published in the ACM and was based on Jakob et al. from 2014. While the original Siggraph paper was brilliant, it wasn't suitable for a production implementation. The original paper by Wenzel Jakob and the team showed effective use of their approach on objects from shoes to Christmas decorations, but a particularly effective demo image showed how a floor broke up a reflected stain glass window.

The Chaos team built on this and produced their version that works very effectively in a production pipeline environment. "Our solution, the Stochastic solution, has the advantage that it can place virtually any number of flakes and it works with a very modest amount of memory, it also avoids the tiling artifacts," explains Vlado.

The 3.4 V-Ray implementation also allows for coloured flakes, which produces a different effect as the colour contribution of the flakes is otherwise normally nearly completely lost. "We can sample random flake colours from a colour ramp, .. you can use any gradient ramp to sample from, which makes it very flexible for users," he explains.

While this technique is providing faster and better solutions for snow, water and car paint (the flake class of problems), it is not a general purpose solution and does not, for example, solve the similar problem in human skin and the way microfacet specular highlights are anisotropically produced by asymmetrical skin stretching and deformation. The solution is based on sampling the surface, in patches, based on the number of 'flakes' or what Vlado describes as 'infinitely small mirrors'.

It is an approach only for point scatterers, the problem with the generalization (to simulate say water or skin) would require a different approach with normal maps, but at the moment such algorithms are very memory hungry. Chaos Group is still exploring more generalised solution but this limited implementation does solve a subset class of such problems and it does so without the previous slow downs or memory problems.

Vlado next aims to add scratches and micro surface marks with their new approach. "This is what we want to do next and in the same (procedural) and stochastic fashion," he explains. By doing the marks and scratches on the fly the team maintains a very shallow memory footprint and can maintain the production speed they are always very aware to target.

We've been a free service since 1999 and now rely on the generous contributions of readers like you. If you'd like to help support our work, please join the hundreds of others and become an fxinsider member.

https://vimeo.com/180604176

I used stochastic flakes! It creates a difference! 🙂

I just need to remember how they called.