I’m having problems with a shader I’m working on. It is an FDM shader to mimic the look of 3D prints; I’ve managed to hammer out most of the bugs but I’m stuck on one last rotation issue that I’m not sure how to fix.
Essentially I’m separating out the object position normals into XYZ and running them through power and multiply. This gives me an isolated mask on top surfaces. As is it’s great for dust but doesn’t rotate with the object or let the user specify which angle of normals should have the texture applied.
So my first step is to add a vector input in degrees to a vector mapping node. I’ve gotten this to work and it allows specifying the angle of faces to be affected in the shader menu. Using a cube as example I can set it to affect the top face, or rotate the X or Y axis by 90° to select one of the side faces.
The problem area is getting the selected normal to rotate with the object. To achieve this I plug the vector output of the first mapping node into a second and feed in the euler values using an attribute node. I also split and recombine the XYZ with invert nodes as the texture rotates in the opposite direction of the object without them. This step actually works perfectly as long as I only rotate the object on ONE axis. In other words, if I mask the top faces I can rotate the cube to any angle along X, Y, Or Z and that face will remain properly masked. However as soon as I rotate it along two axis the mask starts to rotate and fade out in weird ways, I don’t understand why.