Specy Flakes materials (carpaint, snow, sand... advanced)

Just found an article about V-Ray’s practical stochastic rendering of ‘spec-y’ things by Mike Seymour on fxguide.

"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…

… Recently the team at Chaos Group released a version of V-Ray that partly solves this…"

Few examples (more on Chaos Group Research & Papers site: A Practical Stochastic Algo…)
https://www.fxguide.com/wp-content/uploads/2016/10/beetle_toy_300_lid-660x371.jpg

https://www.fxguide.com/wp-content/uploads/2016/10/flakes_colored-660x371.jpg

My guess is, for it to work easy & efficient, it has to be integrated in Cycles.

As for cycles nodes, am only able to achieve similar results based on Car Paint with Flakes Material

So am wondering if there is OSL way around it or some extra nodes that could help emphasize the bling (colorful sparkles)?
Also any other thoughts on the matter are very welcome.

Working on something for you now… hold on a minute…

Not sure how close i can get, but i will try and see whats possible. I have a couple of node groups i think could work for this situation :slight_smile:

This is the closest i could get… it’s no where near as nice looking as V-rays results though… To get something of that level would definatley require some extra features being added to blender.

There was an interesting paper i read a while back related to this subject, it’s about rendering discrete stochastic microfacet surfaces - http://www.cs.cornell.edu/projects/stochastic-sg14/stochastic.pdf
Which would be great if it was coupled with this also - https://people.eecs.berkeley.edu/~lingqi/publications/paper_glints.pdf

Here’s my result anyway -


To get this i used my carpaint nodegroup (Not a shader, but outputs all the data needed to make a speckled shader, excluding bump… but that can be derived from the colour and mask outputs) and also my metallic BSDF nodegroup.

Here is a pic of the shader -


Heres a .blend if you want it - Speckles.blend (1.59 MB)

Maybe you can have a play around with the blend and achieve a better result?

edit: just noticed one of my multiply nodes is set to 180… i’m pretty sure i was meant to put that at 1.8… lol, never mind.

Your normal and tangent inputs are empty, keep in mind that you can use them in unconventional ways to great effect (as in not using the normal input just for the purpose of bumpmaps).

An example would be something like mixing the normal output of the geometry mode with a texture using the ‘overlay’ mode (the first input is needed to ensure the mesh continues to look correct).

@AceDragon - Oh yeah, i know, this was just a couple of minutes work trying to get the basic look,
i have a thread about doing a similar thing to what you mentioned, using procedural textures for distorting vector mapping -

I just thought that maybe with this basic setup, someone with more knowledge than me might be able to get a much better result :slight_smile:

Quick Test With Snow - 500 samples.

Would probably need some more samples to better distinguish speckles from generic noise, but i think the Glinting highlights look pretty good on this. It would of looked more like snow, rather than ice if i had payed more attention to the roughness :o


Nodes -


Hi guys!

Thanks for your gifts and hints :slight_smile:

Strange, didn’t land on your thread before when i was searching forums for flakes and carpaints.

Quickie looks tasty and similar to what i was thinking & imagining later on (voronoi + normals + color ramp > reflection) didn’t had the chance to test it yet.

Yup ultimate goal is to have a fast effect appear as camera/photo based, aligned and continuously balanced… as Ace also noted :wink:

will get back

BTW
i use big flake size, exaggerate for the sake of effect

No problem :slight_smile:

Using the position input from the geometry node usually gives uniform distribution of voroni textures on most meshes, there may be distortion on more complex meshes, although it may give better results if you mix the normal output with it in some creative ways.
I’ve only ever ran into trouble using the position output with the checker, magic and brick textures, as these require some more intricate mapping.

Looking forward to seeing what you come up with :slight_smile:

And i will let you know if i come up with anything else :slight_smile:

Actually, I was talking about abusing the normal input to actually change the shading itself and not just the texture. A basic glint then is very quick to set up and has decent results (note that this isn’t just bumping the surface).


Just make sure to not set the mix value to something too high and you should be fine.

Aaah, that is a good idea! looks great too.

Gonna try that with a sand setup now… Thanks man, that completely slipped my mind :slight_smile:

Okay, the results are much better with your method included!

I’ve decided i’m going to start work on a new node group tomorrow, to allow more control for this perticular shading situation… See if i can get any closer to the desired results. Hopefully create a faked result thats a close enough approximation stochastic shading… I’m probably a bit out of my depth with this, but it’s worth trying anyway :slight_smile:

I’ll post my results up when i have something worth sharing, hopefully we can help each other and work together on creating something good and usefull :slight_smile:

I only have the images, not the node setup, available here. But this is what I was able to achieve when trying to setup a metallic glint material:






1 Like

Only 3 per post, so…:





Iirc this was a mix of Ace’s “Voronoi -> Bump -> Anisotropic Tangent” (which is bizarre), and the normal way of doing flakes. I believe this version uses quite sparse flaking.

1 Like

@Carl G - That looks nice!

Did you plug the bump into the tangent? or did you plug the voroni color into the tangent?

This is the thread I got the tangent setup from. Iirc that does the “reaction to light angle” thing (which we can’t really do), maybe I tried modulating the anisotropic reflection color with other voronoi, or something. It took a whole lot of experimenting, and I’m not fully satisfied with either the result or the controlability. The effect is also a bit “wild” and can only be on the glossy side. Here is a test I did on custom glass, notice how it fails on the “exit side” (refracting side). Not 100% sure what is needed, sometimes I feel I would like to have more control over sampling, maybe in a dedicated shader (closure) to do these things.

Basically, it’s a hack that kind of resembles the concentric rings of scratchy reflections but not fully, it’s time consuming, hard to control, and very non flexible. I wouldn’t recommend it for any production stuff, but might be fun to play around with.

If you want “only flakes”, then stick with what Ace shows above, maybe try to modulate the effect with a gradient voronoi and/or noise (if gradient voronoi > some level, then apply the cell voronoi directly to normal).

@CarlG - Yeah man, i’ve read through the paper mentioned on that thread, i posted that along with another paper in a comment above. I plan to study through these papers again to see if i can extrapolate any information that could be of use to me when trying to replicate results in cycles :slight_smile:

Is that glass shader using the new multiscatter CGX or traditional CGX? as i know that the traditional CGX can have problems with energy loss with increasing roughness? may explain the failing on the “exit sides”? Unless the glinting is achieved using a speckly glossy overlay ontop of the glass? in which case i have no idea why the effect is not apparent on its rear sides.

Ultimately i would like to achieve an effect that is of a similar quality to this really -


Interesting paper from Nvidia - https://research.nvidia.com/sites/default/files/publications/ZirrKaplanyan_MultiscaleI3D2016_0.pdf

In case it helps, the glint setup I posted to this thread only works properly when the shading model is set to multiscatter GGX (regular GGX gives problems with producing a realistic falloff from the center of highlights).

So it does more than prevent rough surfaces from becoming too dark (because you notice the difference in this case even with very low values).

@Ace Dragon - Yet again, another very usefull bit of info i did not know! thanks again…

Your brain is truly a repository of usefull facts and information :slight_smile:

To be honest, I don’t always know how the math actually works (but you don’t actually need to know as long as the final result looks convincing).

In this case, I didn’t actually try to copy the math from the papers (which is very complex stuff). The good news though is that the Cycles nodes had what is needed to avoid having to mess with manual calculation (that being creating the impression of randomly tilted normals, which I assume would play major part in creating the glints in CG)