NokiMo
colortwist
colortwist

patreon


Sequin material study

Every so often I see something and go "I like that".

Other times I go "I want that".

While it should be pretty obvious what drives me forward in CG (I mean, I'm only really doing everything for one specific reason), I also like to try and push the limits every so often. More recently, I'd seen a fairly popular IG model wearing a sequin styled swimsuit, and both went "I like that" promptly followed by "I want that".

Thus began my quest to create a procedural sequin shader in 3D.

For those of you unfamiliar with that term, sequins are basically small round donut shaped disks made from metal or plastic that usually land up getting fastened to a piece of fabric somehow. They tend to randomly orient themselves about the surface normal of the object they're attached to, creating a fascinating effect of glints and sparkles as they reflect the environment around them. If you rub your hand over them, you can create a "sweeping" effect that essentially reorients them in the general direction of the brushing.

Creating such an effect in 3D poses several peculiar challenges. While it would be fairly simple to just render out some sort of pre-baked set of textures that represent each sequin as a tiny donut with a randomized surface normal, such a technique would probably be prone to tiling artifacts and you wouldn't be able to control the sequins during render to create the illusion of some more subtle effects (like simulating a directional brushing across the sequins).

It might be possible to create a shader that handles everything procedurally, but that's where the complexities start piling up. The first and foremost issue is "how do you draw hexagons of arbitrary size without using any sort of external code?". The second is "how do you randomize each sequin, but still maintain enough control over them so you can bias that randomization to create a visually pleasing result?".

This is probably one of those things that I should have given up on after the second day, but the problem seemed rudimentary enough that there had to be a clever and concise solution. Drawing hexagons isn't particularly complicated if you have access to a high level shading language like OSL (or you're willing to write a C++ texture generator plugin), but there's just enough branching and math involved that it can't really be done strictly inside a shader node graph.

Or can it?

Eventually I stumbled upon a solution which let me do exactly that. In fact, it ultimately eliminated nearly all the mathematical complexity involved with drawing hexagons, and 100% of the branching required to make that happen. The entire shader network that generates the hexagons is less than 10 nodes and incurs a minimal performance overhead when rendering. Likewise, everything is generated procedurally, so every single aspect of the shader can be controlled in realtime- from the random tints of each sequin, to the direction they're pointing, their size, shape, edge profile, etc, etc.

Ultimately I'm pretty happy with how this turned out since I don't think it would be possible to easily achieve similar results using a texture based setup. These shaders will likely land up being used on a couple of upcoming projects, since, well- the whole point why I started working on this in the first place was to build a new (and somewhat unique) shader for some fancy swimsuit fabric.

Sequin material study

Comments

That's fascinating. And it's impressive to me that you have the ability to make this stuff from scratch.

Dan


Related Creators