Difference between revisions of "Line MAT"

From TouchDesigner Documentation
Jump to: navigation, search
m
m
 
Line 20: Line 20:
  
 
When you are animating Ortho Width or Field of View, you may want line widths to adjust more realistically. When the parameter "Width Affected by FOV/Ortho Width" is on, the behavior is different: For Ortho cameras, the drawn line width increases when Ortho Width drops below 1, (as if you are zooming into it), and decreases when Ortho Width increases above 1. For Perspective cameras, the drawn line width increases when Field of View drops below 90 degrees, and decreases when Field of View increases above 90 degrees. Note that when the parameter "Width Affected by FOV/Ortho Width" is on, lines are still resolution-independent.
 
When you are animating Ortho Width or Field of View, you may want line widths to adjust more realistically. When the parameter "Width Affected by FOV/Ortho Width" is on, the behavior is different: For Ortho cameras, the drawn line width increases when Ortho Width drops below 1, (as if you are zooming into it), and decreases when Ortho Width increases above 1. For Perspective cameras, the drawn line width increases when Field of View drops below 90 degrees, and decreases when Field of View increases above 90 degrees. Note that when the parameter "Width Affected by FOV/Ortho Width" is on, lines are still resolution-independent.
 +
 +
Intro article here from NVoid: [https://www.elburz.io/new-superpowers-touchdesigners-line-mat/ new-superpowers-touchdesigners-line-mat/]
  
 
}}{{ParameterPage
 
}}{{ParameterPage

Latest revision as of 00:42, 12 November 2019

Summary
[edit]

The Line MAT renders 3D line segments, dots and vectors. The line width and color can be varied based on distance to the camera, using two models: a 1/z dropoff (z = distance from camera), or a near-far distance rolloff model, where you set the width and color at the near and far distances, and you vary three rolloff controls.

For lines it renders different types of end caps and hinge/joints (round, box, arrow). The light model is flat-shaded (no affect from scene lighting). It draws edges (like polygon edges), points and vectors from points. There are different parameters to control the desired shape, as explained in the Parameter sections. It renders several primitive types: polygons, meshes, NURBS, quads, etc. It also manages closed polygons / open polygons.

You can render a dot at each point. You can render a vector at each point which uses any attribute, like Normal (N). The points or vectors can have their own colors and alpha.

Line Width is a resolution-independent quantity. A line width of 1 will draw a line that is 1/1000 the width of the image. This is true when used with orthographic cameras and perspective cameras.

To make the width of a line and its points vary per-point of a SOP, the width can be set by adding a point attribute width on the SOP being rendered. A value of 2 scales the width at that point by 2 times its normal width. New point attributes can be created with the Point SOP Custom page. To affect per-point width and nof affect the line width, use the point attribute pscale.

When you are animating Ortho Width or Field of View, you may want line widths to adjust more realistically. When the parameter "Width Affected by FOV/Ortho Width" is on, the behavior is different: For Ortho cameras, the drawn line width increases when Ortho Width drops below 1, (as if you are zooming into it), and decreases when Ortho Width increases above 1. For Perspective cameras, the drawn line width increases when Field of View drops below 90 degrees, and decreases when Field of View increases above 90 degrees. Note that when the parameter "Width Affected by FOV/Ortho Width" is on, lines are still resolution-independent.

Intro article here from NVoid: new-superpowers-touchdesigners-line-mat/

PythonIcon.pnglineMAT_Class

Parameters - Setup Page

This is a general setup page for globally control the shared features of Lines, Points, and Vectors. Every change in this page will affect all the three mentioned types.

Depth Interpolation Model depthinterpolationmodel - - Depth Interpolation Model depthmodel – a menu to select how the width of line items changes by their distance from the camera.

  • S Curve scurve - a bounded range for the width between the near and far planes (Distance Near and Far) that uses S Curve for a more dramatic and yet smooth (referring to the continuity of the curve) changes. The curve shape can be controlled by Bias, Steepness, and Linearize parameters.
  • Inverse Distance inversedistance - uses the inverse distance weighting which provides a more visually accurate changes on the final width.

Distance Near distancenear - Specifies a near plane with a certain distance from the camera.  

Distance Far distancefar - Specifies a far plane with a certain distance from the camera.  

Width Near widthnear - Specifies a fixed width value when the distance from camera is less than or equal to Distance Near. See the Summary of this operator for an explantion of the treatment of line width.  

Width Far widthfar - Specifies a fixed width value when the distance from the camera is equal or bigger than the Distance Far. Note when the Near-Far Range option is selected as the Depth Model, any point in between Distance Near and Distance Far will be calculated based on sine curve.  

Width Bias widthbias - Moves the S Curve’s bias backward or forward for width interpolation (only S Curve depth model).  

Width Steepness widthsteepness - Controls the steepness of the S Curve for width interpolation (only S Curve depth model). The higher the value of the steepness, you will notice more dramatic changes (higher slope) in the curve width. Also, with lower values of steepness, the curve transforms into a more linear form.  

Width Linearize widthlinearize - Control the amount of curvature in the curve for width interpolation (only S Curve depth model).  

Color Bias colorbias - Moves the S Curve’s bias backward or forward for color interpolation.  

Color Steepness colorsteepness - Controls the steepness of the S Curve for color interpolation.  

Color Linearize colorlinearize - Control the amount of curvature in the curve for color interpolation.  

FOV Independent fovindependent - Toggle to make the width independent from the field of view. Note that enabling this toggle can in some case lead to losing resolution independence.  

Lift Direction liftdirection - - Specifies an offset for displacing the line points along with the Camera Z or along with normal direction.

  • Along Camera Z Axis alongcamerazaxis - displace the points along Camera Z axis.
  • Along Normal alongnormal - displace the points along point's Normal vector.

Parameters - Line Page

Draw Lines drawlines - A toggle to draw the Line polygons.  

Line Joint Type linejointtype - - A menu to select the joint type where two lines segments meet.

  • Round round - a round joint.
  • Miter miter - a sharp miter joint.
  • Bevel bevel - a square shaped joint.

Miter Threshold (deg) miterthreshold - Specifies a threshold value in degrees for the Miter joint which alters the joint shape to Bevel joint if the angle between each two lines segments is bigger than this value.  

Line Start Cap Type linestartcaptype - - A menu to Specify the end cap type at the Line start. You can control the size of each end cap type in the Cap page.

  • Round round -
  • Square square - Square shaped end cap.
  • Triangle triangle - Triangle shaped end cap.
  • Arrow arrow - Arrow Shaped end cap.
  • None none - No end cap (flat shaped).

Line End Cap Type lineendcaptype - - A menu to Specify the end cap type at the Line end.

  • Round round - Refer to Line Start Cap Type
  • Square square - Refer to Line Start Cap Type
  • Triangle triangle - Refer to Line Start Cap Type
  • Arrow arrow - Refer to Line Start Cap Type
  • None none - Refer to Line Start Cap Type

Line End Taper Strength lineendtaperstrength -  

Line Near Color linenearcolor - - Specifies the color value for the Line at the Distance Near plane and any location closer to camera.

  • Red linenearcolorr -
  • Green linenearcolorg -
  • Blue linenearcolorb -

Line Near Alpha linenearalpha - Specifies the alpha value for the Line at the Distance Near plane and any location closer to camera.  

Specify Line Far Color specifylinefarcolor - A toggle to use the far color and interpolate the values between near and far color.  

Line Far Color linefarcolor - - Specifies the color value for the Line at the Distance Far plane and beyond (farther from camera).

  • Red linefarcolorr -
  • Green linefarcolorg -
  • Blue linefarcolorb -

Line Far Alpha linefaralpha - Specifies the alpha value for the Line at the Distance Far plane and beyond (farther from camera).  


Parameters - Point Page

Draw Points drawpoints - A toggle to draw the Points.  

Point Type pointtype - - A menu to select the Point type.

  • Circle circle - draws circle on each point of the geometry.
  • Sphere sphere - draws sphere on each point of the geometry.

Point Size Multiplier pointsizemultiplier - Specifies a scale coefficient to the size of the Point. By default, the point radius size equals to the width at the point’s location from the camera.  

Point Near Color pointnearcolor - - Specifies the color value for the Point at the Distance Near plane and any location closer to camera.

  • Red pointnearcolorr -
  • Green pointnearcolorg -
  • Blue pointnearcolorb -

Point Near Alpha pointnearalpha - Specifies the alpha value for the Point at the Distance Near plane and any location closer to camera.  

Specify Point Far Color specifypointfarcolor - A toggle to use the far color and interpolate the values between near and far color.  

Point Far Color pointfarcolor - - Specifies the color value for the Point at the Distance Far plane and beyond (farther from camera).

  • Red pointfarcolorr -
  • Green pointfarcolorg -
  • Blue pointfarcolorb -

Point Far Alpha pointfaralpha - Specifies the alpha value for the Point at the Distance Far plane and beyond (farther from camera).  


Parameters - Vector Page

Draw Vectors drawvectors - A toggle to draw the Vectors at each point.  

Attribute attribute - Specify the geometry Attribute to use to render the Vector. Some standard attribute are: N, P, Cd, uv, however it is possible to specify a custom attribute. Note that this value is case sensitive, ensure that the it matches with the name of the attribute for that point/vector.  

Scale scale - A scale value which applies on the length of the Vector.  

Vector Start Cap Type vectorstartcaptype - - A menu to Specify the end cap type at the Vector start. You can control the size of each end cap type in the Cap page.

  • Round round -
  • Square square -
  • Triangle triangle -
  • Arrow arrow -
  • None none -

Vector End Cap Type vectorendcaptype - - A menu to Specify the end cap type at the Vector end. You can control the size of each end cap type in the Cap page.

  • Round round -
  • Square square -
  • Triangle triangle -
  • Arrow arrow -
  • None none -

Vector Taper Strength vectortaperstrength - : A coefficient to scale the width of end part of the Vector.  

Vector Near Color vectornearcolor - - Specifies the color value for the Vector at the Distance Near plane and any location closer to camera.

  • Red vectornearcolorr -
  • Green vectornearcolorg -
  • Blue vectornearcolorb -

Vector Near Alpha vectornearalpha - Specifies the alpha value for the Vector at the Distance Near plane and any location closer to camera.  

Specify Vector FarColor specifyvectorfarcolor - A toggle to use the far color and interpolate the values between near and far color.  

Vector Far Color vectorfarcolor - - Specifies the color value for the Vector at the Distance Far plane and beyond (farther from camera).

  • Red vectorcolorfarr -
  • Green vectorcolorfarg -
  • Blue vectorcolorfarb -

Vector Far Alpha vectorfaralpha - Specifies the alpha value for the Vector at the Distance Far plane and beyond (farther from camera).  


Parameters - Caps Page

Round Width roundwidth - Specifies a scale to the width of Round end caps.  

Round Height roundheight - Specifies a scale to the height of Round end caps.  

Square Width squarewidth - Specifies a scale to the width of Square end caps.  

Square Height squareheight - Specifies a scale to the height of Square end caps.  

Triangle Width trianglewidth - Specifies a scale to the width of Triangle end caps.  

Triangle Height triangleheight - Specifies a scale to the height of Triangle end caps.  

Arrow Width arrowwidth - Specifies a scale to the width of Arrow end caps.  

Arrow Head arrowhead - Specifies a scale to the height (from the base of arrow to the head) of Arrow end caps.  

Arrow Tail Length arrowtaillength - Specifies a scale to the tail length of Arrow end caps (the longer the tail the sharper it will look like).  


Parameters - Deform Page

Refer to the Deform Article for more information on doing deforms in TouchDesigner.

Deform dodeform - Enables deforms on this material.  

Get Bone Data: deformdata - - Specifies where the deform bone data will be obtained.

  • From a SOP sop -
  • From another MAT mat -
  • From a DeformIn MAT deformin -

SOP with Capture Data targetsop - Specifies the SOP that contains the deform capture attributes.  

pCaptPath Attrib pcaptpath - Specifies the name of the pCaptPath attribute to use. When your geometry has been put through a Bone Group SOP, the attributes will be split into names like pCaptPath0, pCaptPath1. You can only render 1 bone group at a time, so this should match the group you are rendering with this material.  

pCaptData Attrib pcaptdata - Much like pCaptPath Attrib.  

Skeleton Root Path skelrootpath - Specifies the path to the COMP where the root of the skeleton is located.  

MAT mat - When obtaining deform data from a MAT or a Deform In MAT, this is where that MAT is specified.  


Parameters - Common Page

Blending

Blending is summing the color value of the pixel being drawn and the pixel currently present in the Color-Buffer. Blending is typically used to simulate Transparency. The blending equation is: Final Pixel Value = (Source Blend * Source Color) + (Dest Blend * Destination Color)


Blending(Transparency) blending - This toggle enables and disables blending. However see the wiki article Transparency.  

Source Color * srcblend - - This value is multiplied by the color value of the pixel that is being written to the Color-Buffer (also know as the Source Color).

  • Zero zero -
  • Dest Color dcol -
  • One Minus Dest Color omdcol -
  • Source Alpha sa -
  • One Minus Source Alpha omsa -
  • Dest Alpha da -
  • One Minus Dest Alpha omda -
  • Source Alpha Saturate sas -
  • One one -

Destination Color * destblend - - This value is multiplied by the color value of the pixel currently in the Color-Buffer (also known as the Destination Color).

  • One one -
  • Src Color scol -
  • One Minus Src Color omscol -
  • Source Alpha sa -
  • One Minus Source Alpha omsa -
  • Dest Alpha da -
  • One Minus Dest Alpha omda -
  • Zero zero -

Separate Alpha Function separatealphafunc - This toggle enables and disables separate blending options for the alpha values.  

Source Alpha * srcblenda - - This value is multiplied by the alpha value of the pixel that is being written to the Color-Buffer (also know as the Source Alpha).

  • Zero zero -
  • Dest Color dcol -
  • One Minus Dest Color omdcol -
  • Source Alpha sa -
  • One Minus Source Alpha omsa -
  • Dest Alpha da -
  • One Minus Dest Alpha omda -
  • Source Alpha Saturate sas -
  • One one -

Destination Alpha * destblenda - - This value is multiplied by the alpha value of the pixel currently in the Color-Buffer (also known as the Destination Alpha).

  • One one -
  • Src Color scol -
  • One Minus Src Color omscol -
  • Source Alpha sa -
  • One Minus Source Alpha omsa -
  • Dest Alpha da -
  • One Minus Dest Alpha omda -
  • Zero zero -

Depth Test

Depth-Testing is comparing the depth value of the pixel being drawn with the pixel currently in the Frame-Buffer. A pixel that is determined to be in-front of the pixel currently in the Frame-Buffer will be drawn over it. Pixels that are determined to be behind the pixel currently in the Frame-Buffer will not be drawn. Depth-Testing allows geometry in a 3D scene to occlude geometry behind it, and be occluded by geometry in-front of it regardless of the order the geometry was drawn.

For a more detailed description of Depth-Testing, refer to the Depth-Test article.


Depth Test depthtest - Enables and disables the Depth-Test. If the depth-test is disabled, depths values aren't written to the Depth-Buffer.  

Depth Test Function depthfunc - - The depth value of the pixel being drawn is compared to the depth value currently in the depth-buffer using this function. If the test passes then the pixel is drawn to the Frame-Buffer. If the test fails the pixel is discarded and no changes are made to the Frame-Buffer.

  • Less Than less -
  • Less Than or Equal lessorequal -
  • Equal equal -
  • Greater Than greater -
  • Greater Than or Equal greaterorequal -
  • Not Equal notequal -
  • Always always -

Write Depth Values depthwriting - If Write Depth Values is on, pixels that pass the depth-test will write their depth value to the Depth-Buffer. If this isn't on then no changes will be made to the Depth-Buffer, regardless of if the pixels drawn pass or fail the depth-test.  

Alpha Test

Alpha-testing allows you to choose to draw or not draw a pixel based on its alpha value.


Discard Pixels Based on Alpha alphatest - This enables or disables the pixel alpha test.  

Keep Pixels with Alpha alphafunc - - This menu works in conjunction with the Alpha Threshold parameter below in determining which pixels to keep based on their alpha value.

  • Less Than less -
  • Less Than or Equal lessorequal -
  • Greater Than greater -
  • Greater Than or Equal greaterorequal -

Alpha Threshold alphathreshold - This value is what the pixel's alpha is compared to to determine if the pixel should be drawn. Pixels with alpha greater than the Alpha Threshold will be drawn. Pixels with alpha less than or equal to the Alpha Threshold will not be drawn.  

Wire Frame

The wire-frame feature will render the geometry as wire-frame, using the actual primitive type used in the render. What this means is surfaces like Metaballs, NURBs and Beziers will become a wire-frame of the triangles/triangle-strips used to render them (since these types of primitives can't be natively rendered in OpenGL).


Wire Frame wireframe - - Enables and disables wire-frame rendering with the option of OpenGL Tesselated or Topology based wireframes.

  • Off off -
  • OpenGL Tesselated Wire Frame tesselated -
  • Topology Wire Frame topology -

Line Width wirewidth - This value is the width that the wires will be. This value is in pixels.  

Cull Face

The cull face parameter will cull faces from the render output. This can be used as an optimization or sometimes to remove artifacts. See Back-Face Culling for more infomation.


Cull Face cullface - - Selects which faces to render.

  • Use Render Setting userender - Use the render settings found in the Render or Render Pass TOP.
  • Neither neither - Do not cull any faces, render everything.
  • Back Faces backfaces - Cull back faces, render front faces.
  • Front Faces frontfaces - Cull front faces, render back faces.
  • Both Faces bothfaces - Cull both faces, render nothing.

Polygon Depth Offset

This feature pushes the polygons back into space a tiny fraction. This is useful when you are rendering two polygons directly on-top of each other and are experiencing Z-Fighting. Refer to Polygon Depth Offset for more information. This is also an important feature when doing shadows.


Polygon Depth Offset polygonoffset - Turns on the polygon offset feature.  

Offset Factor polygonoffsetfactor -  

Offset Units polygonoffsetunits -  

   TouchDesigner Build: 

MATs
Constant • Experimental:Constant • Depth • GLSL • Experimental:GLSL • In • Line • MAT • MAT Common age • Null • Out • PBR • Experimental:PBR • Phong • Experimental:Phong • Point Sprite • Select • Switch • Texture Sampling arameters • Wireframe

An Operator Family that associates a shader with a SOP or Geometry Object for rendering textured and lit objects.

An Operator Family that reads, creates and modifies 3D polygons, curves, NURBS surfaces, spheres, meatballs and other 3D surface data.

Each SOP has a list of Points. Each point has an XYZ 3D position value plus other optional attributes. Each polygon Primitive is defined by a vertex list, which is list of point numbers.

TouchDesigner is a hierarchy of components. "root" is the top-most network in the hierarchy. The Path is simply /. A typical path is /project1/moviein1.

The location of an operator within the TouchDesigner environment, for example, /geo1/torus1, a node called torus1 in a component called geo1. The path / is called Root. To refer instead to a filesystem folder, directory, disk file or http: address, see Folder.

An Operator Family that contains its own Network inside. There are twelve 3D Object Component and eight 2D Panel Component types. See also Network Path.

The term "Frame" is used (1) in the Timeline, (2) as a time-unit in CHOPs, (3) as a time-unit in TOPs, and (4) with movies images which are read and created with TOPs.

The connection of an output of one node to the input of another node in a network. In contrast, see Link.

An Operator Family that creates, composites and modifies images, and reads/writes images and movies to/from files and the network. TOPs run on the graphics card's GPU.