GenerateUVSetByContourStretching

Categories

texture

Description

Create a new set of texture coordinates by contour stretching the polygon inputs onto a "surface" pinned on the contour of the polygon inputs. A proper contour of the polygon inputs must exist to guide the contour stretching process.

Scripting Syntax

oReturn = GenerateUVSetByContourStretching( InputObjs, PropertyName, [ContourStretchingMethod], [MaintainAspect], [CornerPoints] );

Return Value

Returns an XSICollection object that contains two XSICollection objects. The first is a list of the created properties. The second is a list of the created operators.

Parameters

Parameter Type Description
InputObjs String List of polygon inputs to which the polygon UV texture coordinate contour stretching operator is applied.

Default Value: Selected objects

PropertyName String Name suggestion for the texture coordinates.
ContourStretchingMethod siTxtContourStretchingMethod Polygon cluster contour stretching method.

Default Value: siContourStretchingWalkingOnMesh

MaintainAspect Boolean Whether to maintain aspect ratio.

Default Value: False

CornerPoints String Optional list of point inputs that define corners on the contour of the polygon inputs. Each input may contain from 0 to N points and only up to the first 4 points of each will be used to define corners. If the input corners are not part of the contour of the polygon inputs then they are ignored.

Default Value: Empty. Corners are derived automatically internally.

Examples

VBScript Example

Dim l_CreatedObjects
NewScene
'This example will create a texture space by contour stretching the contour of 
'set of input polygons.
CreatePrim "Sphere", "MeshSurface"
ActivateRaycastPolySelTool
SelectGeometryComponents "sphere.poly[3,4,11,12,19,20,27,28]"
CreateCluster
'Translate a point and notice that the texture follows the deformation
Translate "sphere.pnt[20]", 0.15, 4.8, -0.48, siRelative, siView, siObj, siXYZ
'Stretch the polygons - Method is by spatial distance, Default for MaintainAspect = FALSE, Pass-in corners.
set l_CreatedObjects = GenerateUVSetByContourStretching( "sphere.polymsh.cls.Polygon", "Texture_Projection", siContourStretchingSpatialDistance, , "sphere.pnt[4,6,32,34]" )
' What was created
logmessage "Created Properties: " & l_CreatedObjects(0)
logmessage "Created Operators:" & l_CreatedObjects(1)
'Use the generated texture space.
ActivateObjectSelTool
ApplyShader , , , , siLetLocalMaterialsOverlap
SIApplyShaderToCnxPoint "Image", "sphere.Material.Phong.diffuse"
SetInstanceDataValue , "sphere.Material.Phong.Image.tspace_id", "Texture_Projection"
SetDisplayMode "Camera", "textured"

See Also

ModifyUVSetByContourStretching