You can toggle this feature and set the line thickness with the Display settings. This helps you visualize the locations of mapping clusters on the object surface. Each of these clusters has an outline called a map seam which appears superimposed over the object in the viewports. That way you can position the clusters precisely over different areas of the underlying texture map for optimal mapping accuracy. In using Unwrap UVW, you usually break up the object's texture coordinates into smaller groups known as clusters. You can animate UVW coordinates by turning on the Auto Key button and transforming the coordinates at different frames. In the latter case, you usually do so in order to use a mapping method unavailable in Unwrap UVW, such as Shrink Wrap. You can use Unwrap UVW as a self-contained UVW mapping tool and texture-coordinate editor, or in conjunction with the UVW Map modifier. > Modifiers menu > UVs, Maps and Materials > Unwrap UVW Enhanced menu: Select one or more objects.> Modifiers menu > UV Coordinates > Unwrap UVW
You can adjust mapping to fit on Mesh, Patch, Polygon, HSDS, and NURBS models using any combination of manual and several different procedural methods. You can also use it to unwrap and edit existing UVW coordinates on an object. Now we can fill this in row by row.The Unwrap UVW modifier lets you assign mapping (texture) coordinates to objects and sub-object selections, and to edit those coordinates by hand as well as with a variety of tools. Triple that to get our ultimate count of vertex copies: Vertex vertices = new Vertex
(That's a middle section of (numLatitudeLines - 1) * numLongitudeLines quads, doubled to two triangles each, and a row of numLongitudeLines triangles around each pole) int numTriangles = numLatitudeLines * numLongitudeLines * 2 My question now, is how do I take those vertices, and create triangles out of them? Or in other words, how do I link said vertices together to form triangle faces?įirst up, our triangle count is. Return new GraphicsMesh(device, vertices) Īnd it does indeed create all the vertices of a sphere here's a picture: Vertex vertices = new Vertex įor (int i = 0 i < positions.Length i++) You can exchange x & z to wind the opposite way around the sphere. Usual formula for a vector in spherical coordinates. It's widest at the equator, and narrows as phi increases/decreases. This determines the radius of the ring of this line of latitude. phi is a latitude angle (north or south of the equator).įloat theta = (float)(texcoords.X * 2.0f * Math.PI) įloat phi = (float)((texcoords.Y - 0.5f) * Math.PI)
theta is a longitude angle (around the equator) in radians. Scale coordinates into the 0.1 texture coordinate range,ġ.0f - ((latitude + 1) * latitudeSpacing) start writing new vertices at position 1įor (int latitude = 0 latitude < numLatitudeLines latitude++)įor (int longitude = 0 longitude <= numLongitudeLines longitude++) +1.0f because there's a gap between the poles and the first parallel.įloat latitudeSpacing = 1.0f / (numLatitudeLines + 1.0f) įloat longitudeSpacing = 1.0f / numLongitudeLines Int numVertices = (numLatitudeLines * (numLongitudeLines + 1)) + 2 One meridian serves as a UV seam, so we double the vertices there.
plus one for the north pole and one for the south. One vertex at every latitude-longitude intersection, I converted this to the following C# example: public static GraphicsMesh GenerateSphere(Device device, int numLatitudeLines, int numLongitudeLines, int radius) I came across a way to create the vertices of a sphere, located here: