I have a bunch of projected circles on multiple surfaces. I’d like to create a texture map of the circles to use as a texture map for the surface. The pattern of circles was originally created in Grasshopper, so solutions in Grasshopper would be welcomed, too. Any thoughts?
Only render engine that supports baking at Rhino is Rhino|AIR from sitexgraphics.com . Maybe this could be a tool for you.
Thanks, Micha. I’ll check it out.
you might check out the rhpicture plugin as well. One possible process is to create a mesh from your surface, create the uv mapping and project or pull the curves to the mapped mesh. Then use barycentric re-mapping to draw each polyline segment into your uv-texture.
Air (BakeAir) is not able to bake curves into textures as far as i know. But it has been very useful for rendering and texture baking shaded materials in the past…
I looked into RhinoAIR. I think I’ll skip that for the moment, but thank you again for your response.
Thanks for your reply. I’m looking into RHPicture plugin. It is intriguing. It may be more than I want to bite off, but since I already know RhinoScript fairly well, it’s an option. A couple questions:
- RHPicture was created back in the Monkey script editor days. Do you know how to install the syntax file now that the script editor is built-in to Rhino 5.0?
- Can you elaborate on the process you outline? I have a a faceted form, so multiple triangular surfaces. I can create a mesh from each of those, join and weld them into a single mesh object. Why do I have to create a UV mapping? Doesn’t the mesh have an inherent UV coordinate system? I’m not all that familiar with working with meshes…
- What is a barycentric re-mapping? I’m reading about it, but I don’t understand why this would be necessary if I’ve already projected/pulled the curves to the mapped mesh.
Thanks for your help. This is an interesting direction that if isn’t useful for my current project, may come in handy anyway. I’d like to learn more, please!
good questions i hope i can explain point 2 and 3 with my limited knowledge:
Maybe @DavidRutten can give us a hint. In general to use RhPicture from Rhino 5 (x86 and x64) the syntax file is not required.
UV-mapping (unpacked) is required to know where to draw in the texture. Once you apply a mapping, every triangle vertex gets a 2d texture coordinate which is the x,y location of a pixel in the texture map. Usually these coordinates have a range between 0 and 1 and need to be scaled using the image dimensions. In general, you can yet draw with texture coordinates using a line pen but only if you eg. draw the edges of a triangle, where you exactly know the coordinate associated from each mesh vertex. This plugin uses that functionality and if i find some time i will add baking of 3d curves to it.
For example, to draw a triangle outline, made from 3 lines into your texture. You can draw 3 lines with the line & pen object of RhPicture, the first triangle edge uses the first and second 2d coordinate of the triangle vertex 0 and 1, second line uses 1 and 2, third line uses 2 and 0. This is all easy as long as you only need to draw the edges of the triangle, but once you need to draw from a point inside the triangle you have to calculate the 2d coordinate yourself.
The latter can be done using a barycentric coordinate system. Which means, you know onto which triangle you like to draw, get the 3 texture coordinates and then calculate a new 2d coordinate in relation to the 3D point inside the triangle.
One note about UV-Mapping compared to projective (eg. planar) mapping. If you have eg. a cube using a planar texture mapping you have non unique coordinates. Which means, parts of your image are applied twice, as long as you use “unpacked” texture coords. Such mappings are not suited for baking 3d geometry into the texture (eg. curves projected on the cube). You would overwrite things as you map (draw) 6 times in the same image. Use packed texture coordinates only to prevent this.
Some tips: RhPicture allows to draw simple primitives, Lines, Circles, Squares etc. In order to draw 3D curves or splines, they need to be processed as (small) polyline segments. Take care if these segments are crossing unwelded mesh edges.
Depending of the amount of geometry, RhPicture takes a while to complete. You might consider drawing with python`s image object which is a bit faster.
Below is a small test scene with different curve colors and widths to demonstrate. Please preview this in Rendered display mode and assign the texture to the mesh cube and unwrapped mesh, if it is not already assigned.
BakedCurves.zip (679.9 KB)