Here is a way to transform procedural texture to a texture file.
In this description a procedural texture is a function that transform a coordinate in euclidean space (X, Y, Z) to a colors (Red, Green, Blue and why not Alpha).
Unwrap the object(s) you want to texture, this object could be also an object that is just used as support of UV mapping (used with Texture Matching)
Open the Grasshopper Script
Set render mesh(s) the the Mesh Component, if there are many meshes, use Mesh Join
Choose the number of pixels for the texture file (512, 1024 …)
Click on do the work
The component will output a list of points (XYZ)
Transform these point to colors
Give a path for a texture file, just PNG output at the moment, if extension is not png it will be changed to PNG
Click on “Do The Work”
Wrapping texture on meshes was something I always seen on other softwares but completely miss on on rhino.
I can see many situations where this might come handy by creating ultra-light models with alpha channel and disabled filtering.
Thanks for sharing this, Laurent!
Top!
@nathanletwory it could be interesting to do the same with texture generator in Rhinoceros/Cycle/Grasshopper. Do you know if it is possible to get the color in physical space (xyz) not UV space? At the moment all the tools in Rhinoceros works well, thanks for that. I had some problem with Texture Matching but I wasn’t able to repeat simply the error in order to post the problem!
You’d determine the UV coordinate based on the XYZ coordinate. Lets ask @Jussi_Aaltonen what the SDK tools in Rhino are to do this, he maintains the texture baking code in Rhino.
It’d be quite interesting to bake Cycles textures indeed. Cycles has bake functionality where for one or more objects the entire raytracing process is baked to texture but that I haven’t hooked up. So in addition to the normal albedo pass you’d get everything you’d choose - shadows, highlights, etc. That is commonly used to speed up rendering in especially animations and game models.
Continuing this discussion, I recently implement an obj importer for Nautilus. As I tested the texture coordinates I wanted to go a bit further. I will add in Nautilus a tool that output as a mesh the mesh in UV space, the tool will also transform coordinate.
here is Spot from Keenan Crane, textured using Human.
I use Bitmap plugin to convert a list of color to an Image.
Then the image is copied to the hard disk and applied to the mesh.
Here the difference between a mesh with color at vertex or texture.