Texture SOP

From TouchDesigner 088 Wiki

06 TextureSOP.jpg

Summary

The Texture SOP assigns texture UV and W coordinates to the Source geometry for use in texture and bump mapping. It generates multi-layers of texture coordinates.

PythonIcon.png textureSOP_Class

Fixing Seams & Unrolling Geometry

NOTE: the following discussing pertains only to face and hull primitives.

If a texture type requires fixing of seams and the texture is applied to vertices, the wrapped primitives are unrolled before computing the texture coordinates. Unrolling a wrapped primitive turns it into an open primitive whose new vertices use the same points as the vertices they have been uniqued from. Thus, unrolling does not change the point count, nor does it allow cracks to appear further down the road. Explicit unrolling, using the Primitive SOP, is not required.

The seam fixing is done after computing the texture coordinates. It is required whether textures are applied to vertices or points, and it's done in u, v, or both.

The following texture types require fixing of seams:

  • Cylindrical - seams fixed in u.
  • Polar - seams fixed in u and v.
  • Row/col - seams fixed in u and v.
  • Spline types: Uniform, Chord Length, and Average - seams fixed in u and v.

Note: When the projection type is Cylindrical or Polar, closed meshes, Bzier & NURBS surfaces will be opened. At least one row/column of vertices will be added (possibly more for NURBS<). This is to prevent poor interpolation of texture coordinates at the seam of the join.

Parameters

Group group - If there are input groups, specifying a group name in this field will cause this SOP to act only upon the group specified. Accepts patterns, as described in Pattern Matching.

Texture Layer texlayer - If the geometry has multiple textures layers applied to it, this parameter determines which layer of UV coordinates this Texture SOP will effect.

Texture Type type - The Face, Uniform Spline, and Arc-Length Spline texturing methods accept spline curves as well as polygons.

When using one of the spline-based methods, specifying a paste hierarchy in the Group field will propagate the computation of texture coordinates to all of its nodes. Projection methods will typically yield smoother texture continuity between pasted surfaces than any of the spline methods. Sometimes it helps ensuring that pasted features are Chord-length parameterized with the Basis SOP.

  • Orthographic - Direct projection from Projection Axis.
  • XYZ Position -
  • Polar - Wrap spherically in Projection Axis direction.
  • Cylindrical - Wrap cylindrically in Projection Axis direction.
  • Rows and Columns - For geometry constructed as a mesh (Grid, Sphere, Tube, Skin, and Sweep). The U coordinates are placed along rows, and the V coordinates along columns. This is good for texturing curved meshes such as car fenders where you cannot project from any one axis.
  • Face - Maps a copy of the texture onto every face. You should make points unique using a Facet SOP, before using this function in the Texture SOP. The map is graphically projected to each face along its normal, so the texture is oriented properly for each face. However, the map is not scaled to fit each polygon, nor is it distorted by the shape of each polygon. If the geometry changes in size in object space, the texture does not "stick" to the geometry. It is best suited to texturing objects that represent chunks of rock and brick, as the textures will likely not match at the edges between polygons.
  • Modify Source - If the Source already has texture UV coordinates, they are maintained. You can offset and scale them, however, using Scale and Offset.
  • Uniform Spline - This projection type operates only on NURBS and Bzier surfaces. It samples the domain space (i.e. the basis) of each surface uniformly in U and V and assigns those (u,v) values as texture coordinates to the surface points or vertices. To ensure continuity between the texture space of adjacent surfaces insert a Basis SOP before the Texture SOP and toggle Concatenate on to merge the spline bases in U and/or V.
  • Average Spline - Stores the average of degree successive knots into the texture attribute. These averages are known as Greville points. This method and Uniform Spline are recommended for pasted surfaces.
  • Arc Length Spline - This method is similar to the Uniform Spline method since it relies on the underlying spline basis when computing the texture coordinates. Both methods generate texture coordinates in the same range, bounded by the minimum and maximum knot values. The difference between the two spline methods lies in the spacing between successive texture coordinates. The uniform method samples the parameter space uniformly. The Arc-Length Spline method chooses the texture coordinates based on surface arc-lengths.
  • Edge Length - applies to hulls + faces (NURBs/Bezier/Polygon).
  • Perspective From Camera - The texture coordinates are assigned so that the world space of the object can be textured to fit the projection of the camera exactly. If any points are behind the near clipping plane or beyond the far clipping plane, the texture coordinates (0, 0, 0) are assigned. Note: Unless a Custom Projection matrix is used in the Camera COMP, the aspect ratio of the projection is assumed to be 1:1. You may need to scale the UVs to match the aspect ratio of your render.

Since the Uniform Spline method relies heavily on the parametric fabric of the surface, the resulting texture will tend to squash and stretch given uneven surface parameterizations. The Arc-Length Spline method reduces this effect by relating the texture space directly to the world space of the surface, while ensuring that the size and origin of the generated texture space coincide with those of the underlying domain.

Projection Axis axis - Axis to project along, or projection method from splines. X, Y, or Z axes.

Camera Name camera - This is used when the Perspective From Camera Texture Type is selected. The menu is used to select which light or camera to project the perspective coordinates from.

Apply To coord - Select to apply texture coordinates to their Natural Location, Point textures, or Vertex textures.

When Natural location is selected, the UV's will be applied to the verticies when using Polar, Cylindrical, Rows and Columns, and Face texture types. Orthographic, Uniform Spline, Average Spline and Arc Length Spline will always generate point UV's when you choose Natural.

Natural Location will also create vertex uvs when creating new texture layers, if a vertex uv already exists for layer 0.

If the primitive is open in both directions like a grid or a surface (so that the ends do not touch), then the advantage of vertex UV's does not apply since there are no matched seams on the single surface to worry about.

Using vertex UVs gives you unique points at the closed seam whereas point UVs are shared at seams and are, by default given a value of 0 for either U or V depending on the closed direction of the surface. If you want to make a closed surface open, simply insert a Carve SOP in the chain and place a single carve in the surface of the direction that the surface is closed.

Scale su sv sw - Scales the texture coordinates a specific amount.

Offset offsetu offsetv offsetw - Offsets the texture coordinates a specific amount.

Rotate angle - Rotates the texture coordinates the specified value.

Tip: Before applying a spline-based texture projection with the Texture SOP, remap the U and/or V bases of the spline surface (using a Basis SOP) between 0 and 1 to ensure a complete mapping of the texture. If a single texture map must be shared by several surfaces, the surface bases should be concatenated prior to being remapped.

Fix Face Seams fixseams - Attempts to correct texture continuity at face seams.

Inputs / Geometry Types

Input 1 - Texture Source, accepts all geometry.

Uses / Works in Relation With

Preparing a surface for a 2D image map (texture map) by assigning texture coordinates to the Source.

See Also