Surface Parameters/Orientation


#1

Does anyone know if Rhino handles surface parameters in a uniform way? I’m interested in how surfaces are handled, as i need to make a large set of mostly-planar surfaces all have the same UV orientation for a script. A couple questions:

  1. Do UV parameters follow a right/left-hand rule? i.e. if the U interval is increasing, does this always mean it is revolving about the surface Dir the same in all cases?

*edit: Just realized you can’t define a handedness for a parameter; it’s both.

  1. With fairly planar straight-edged surfaces, the UV intervals seem to be about equal to the length of their respective sides. Does Rhino do something like determine the longer of the edge pairs in a given direction, use that as the interval, and then map that to the shorter edge as well?

I’d also like to have a more intuitive understanding of UV mapping in general. Consider, for instance, a surface which is gaussian in X and Y. Will the UV mapping be like that of a topological contour map, i.e. denser values where dz/dx and dz/dy are higher? Is there ever an occasion where it would be more computationally helpful to map the surface with r and theta rather than U and V?

Thanks for any insight!


(Menno Deij - van Rijswijk) #2

All the surfaces, curves in Rhino are NURBS (Non Uniform Rational B-Splines). It sounds to me that you could benefit from some background information on NURBS.

A book I can recommend is by G. Farin, Curves and Surfaces for CAGD http://www.amazon.com/Curves-Surfaces-CAGD-Fifth-Edition/dp/1558607374

Another good (and free) reference is by Thomas Sederberg, http://cagd.cs.byu.edu/~557/text/cagd.pdf


(Dale Fugier) #3

Hi Bert,

I would say that, in general, this is true, although it does not have to be the case. Command such as Rhino’s Plane command will set the surface’s domain to range from 0.0 to the length in each dimension. Other commands, such as PlanarSrf, will use other techniques, such as the length of trim curves. But the domain of a surface does not have to be related to the size of the surface.

There is a lot to this. You might want to read some background information on this:

http://www.siggraph.org/education/materials/HyperGraph/mapping/r_wolfe/r_wolfe_mapping_1.htm

You might also search “Texture Mapping Properties” in the Rhino help file.

In basic terms, UV mapping allows polygons to be painted with color from an image. The term “map” is where pixels of picture are associated to points on surface. In the case of Rhino, a surface’s render mesh.

When a surface is meshed, texture coordinates are generated. Texture coordinates map the vertices of a mesh back to the original surface. As the results of meshing a surface are dependent on a surface’s parameterization, so are the it’s initial texture coordinates.

When you apply a texture to a surface, you are really applying it to the surface’s render mesh. The colors of the image will be displayed based on the mesh’s texture coordinates. Thus, if your surface has uniform parameterization, the texture coordinates will be uniform, and the picture will display as you might expect. However, if the surface is not uniformly parameterized, then you will see some distortion of the bitmap.

For example, here are two planar surface with identical domains but with different parameterization.

To work around this, Rhino allows you to modify the texture coordinates of a render mesh using a custom Texture Map (again, see the Rhino help file Texture Map).

I’m not sure I’ve explained this very well. Hopefully you can gleam something useful from this.


#4

Hi Dale,

Could you please explain more how to do this? I specifically have a custom mesh and a uv mapping from its set of vertices onto a uniform discretization of a [0,1]x[0,1] bitmap square. How to code the mapping?

I was going through the SampleTextureMapping and I think this might be done by accessing the ON_Xform m_uvw member of ON_TextureMapping.
By the way, when running the sample I have a segmentation fault. Apparently the integer pMR->m_mapping_channels.Count() is not properly declared.

Many thanks!
Pablo