Wood Texture for Cylindrical Objects in OpenSCAD
thingiverse
I decided to share the code that I used to generate the wood textures on one of my recent models (https://www.thingiverse.com/thing:6051989). This script applies wood texture to the vertical sides, but not the top and bottom. I'm excited to see how other people use this script. The simple explanation of how this works is that I just took parallel diagonal slices out of the model. This doesn't rely on any bump map files or anything other than raw geometry programmed in OpenSCAD. The more complicated answer is to take the model, subtract thin diagonal slices from it, and then apply a Minkowski sum (https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#minkowski) on the result with a very small sphere (maybe about 0.3mm) to round out the sharp edges and slightly fill in the gaps. Then I intersect this result with the original model so it maintains the same dimensions as the original model. Then I take the original model, shrink it slightly, and position that in the middle of the modified model to fill in the gap. Usage of the code is very simple: wood_texture([20, 20, 20]){ //this cylinder standing in for an actual model you want texture applied to cylinder(h=20, d=20, $fn=64); } The **wood_texture** module requires size as an array, but also accepts a few other optional parameters to control the texture (grain width, depth, spacing). In preview mode, it won't calculate the Minkowski sum to speed up the preview, but it will when rendering the final model. It should be noted that the more complex model that this is applied to, the longer it will take to render due to the polygon count increasing exponentially.
With this file you will be able to print Wood Texture for Cylindrical Objects in OpenSCAD with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Wood Texture for Cylindrical Objects in OpenSCAD.