In trying to set up a lighting test for the shader and seeing how fast it rendered, I tried to turn up the diffuse bounces to get a more realistic feel on the render. It didn't do anything. Apparently, the way I made the shader with the lambert making the diffuse calculations did not take into account bounces. Now, it does! I just plugged in the physically based diffuse node rather than the lambert.
The shader now has defaults for different metals and different finishes of the metals including: gold, copper, brass, bronze, silver and chrome in aged, dull and polished finishes. The buttons change the diffuse and spec colors depending on which metal is chosen and changes the diffuse and spec intensity, highlight angle and scratch/denting options depending on which finish is chosen.
In order to make this a proper shader I have to rework the spec to utilize PBR spec. Something is wrong with my node network right now I think, when I put it on a fancy model, strange square artifacts appear when I turn up the anisotropic bias/angle. It doesn't show up when I use a surface model SOP rather than build my own.
I've recalculated the normals for the complex model but that doesn't seem to be doing anything.
So on the left is a surface model plugged in for the specular and on the right is my shader how I've built it. Apparently I've got the basic setup correct because it finally gave basically the same results as the surface model because both shaders show artifacting! Which means it is the model and not me. I still have to finagle the pbr spec to perfectly match the surface model though which will be a bit more dissecting but at least it's beginning to be accurate.
So we're getting somewhere! The spec is working now so I decided to start adding the patterns on and see if the spec holds up. For the most part it does, it works on the object reflections but seemingly not on the light reflections. It still looks a bit glossy on the rust, though it is cutting down a bit.
This was another VEX exercise for me. Here I focused on altering the pattern per face.
Metal Tile Features:
In addition to figuring out how to rotate around the face, I had to rework the specular component of the shader in order to make it function like a real shader rather than one that just outputs maps. I switched from using a trace SOP to using PBR specular.
I like the way this has turned out. I need to allow the option to change the rotation of the tile at something different than 90 degrees. Also there needs to be an option to have this brushed metal as a standalone texture, tiles based on UVs in addition to the standard tiles based on primitives.
Dabbling in VEX shaders gives the possibility for textures based on faces rather than UVs, but one must have access to the face id for this to happen.
Voilà! In view, a humble vaudevillian VEX, cast vicariously as both victim and villain by the vicissitudes of fate.
int $fface = getprimid();
Yes, it took longer than I care to admit to find that line of code.
Pretty Picture Time
It occurred to me that I'd lots of lovely renders for SIGGRAPH but never actually posted them online. This is what functionality the shader is capable of so far.
Diamond Plate Steel 2.0
Alright so for some reason, the rotation angle is also based off of the initial shape of the dot. These dots started out as circles and were stretched into ellipses from the rotation formula.
float $newx = $fx * cos($rad) + $fy * sin($rad); //switch to -/+ to change which was on top
float $newy = $fx * sin($rad) + $fy * cos($rad);
Diamond Plated What?
$amount += 1 - smooth(0.0, 1.0, (pow($fx, 2.0) + pow($fy, 2.0) + ($fy * $fx) * 6));
The last bit of xy * 6 turns the ellipses into hyperboles apparently.
Image 3 and 4 are the same settings, but instead of using:
float $newx = $fx * cos($rad) - $fy * sin($rad);
float $newy = $fx * sin($rad) - $fy * cos($rad);
to modify x and y, this was used:
float $newx = $fx * cos($rad) + $fy * sin($rad);
float $newy = $fx * sin($rad) + $fy * cos($rad);
The layer that was on "top" changed!
Diamond Plated Steel
This is a repeating pattern of basically ellipses rotated alternately at +- 45 degrees. I'm trying to implement this one using vex only (yay coding!) by dissecting the soft dots sop. So far I've been able to replicate the dots and add the second "layer" of hashmarks in but I'm not able to rotate the ellipses properly. I've obtained a 30 degree rotation, as shown below.
So far I've tried to rotate the UV coordinates based on a matrix before the ellipses are produced, rotate the ellipses using a matrix after they are produced and finally by altering the equation that is producing the ellipses. The latter has been the most successful but only stretches the shapes rather than physically rotating them.
Compilations and contemplations of my time as a Side Effects intern.