User Guide Cancel

Paths Format Specifications | Substance 3D Designer

  1. Substance 3D home
  2. User guide
  3. Glossary
  4. Getting started
    1. Getting started
    2. Activation and licenses
    3. System requirements
    4. Overview
      1. Overview
      2. What is a Substance 3D file?
    5. Workflow overview
    6. Shortcuts
    7. Tutorials & learning
  5. Interface
    1. Interface
    2. Customizing your workspace
    3. Home screen
    4. Main toolbar
    5. Preferences
      1. Preferences
      2. Project settings
      3. Version control
    6. Explorer
      1. Explorer
      2. Send to... / Interoperability
    7. Graph view
      1. Graph view
      2. Link creation modes
      3. Graph items
        1. Graph items
        2. Dot node (also Portal)
        3. Frame
        4. Comment
        5. Pin
    8. Library
      1. Library
      2. Managing custom content and filters
    9. Properties
    10. 2D view
    11. 3D view
      1. 3D view
      2. Material properties
      3. GLSLFX shaders
      4. Switching your shaders to OpenGL Core Profile
      5. Iray
    12. Dependency manager
  6. Resources
    1. Resources
    2. Importing, linking and new resources
    3. Bitmap resource
      1. Bitmap resource
      2. Bitmap painting tools
    4. Vector graphics (SVG) resource
      1. Vector graphics (SVG) resource
      2. Vector editing tools
    5. 3D scene resource
    6. AxF (Appearance eXchange Format)
    7. Font resource
    8. Warnings from dependencies
  7. Substance graphs
    1. Substance graphs
    2. Substance graph key concepts
    3. Creating a Substance graph
      1. Creating a Substance graph
      2. Graph instances / Sub-graphs
    4. Exposing a parameter
      1. Exposing a parameter
      2. Parameter presets
      3. Visible if: control visibility of inputs, outputs and parameters
    5. Graph parameters
    6. Inheritance in Substance graphs
    7. Output size
    8. Values in Substance graphs
    9. Publishing Substance 3D asset files (SBSAR)
    10. Exporting bitmaps
    11. Exporting PSD files
    12. Sample Substance graphs
    13. Warnings in Substance graphs
    14. Nodes reference for Substance graphs
      1. Nodes reference for Substance graphs
      2. Atomic nodes
        1. Atomic nodes
        2. Bitmap
        3. Blend
          1. Blend
          2. Blending modes description
        4. Blur
        5. Channel shuffle
        6. Curve
        7. Directional blur
        8. Directional warp
        9. Distance
        10. Emboss
        11. FX-map
        12. Gradient (Dynamic)
        13. Gradient map
        14. Grayscale conversion
        15. HSL
        16. Levels
        17. Normal
        18. Pixel processor
        19. SVG
        20. Sharpen
        21. Text
        22. Transformation 2D
        23. Uniform color
        24. Value processor
        25. Warp
        26. Output
        27. Input
      3. Node library
        1. Node library
        2. Texture generators
          1. Texture generators
          2. Noises
            1. Noises
            2. 3D Perlin noise
            3. 3D Perlin noise fractal
            4. 3D Ridged noise fractal
            5. 3D Simplex noise
            6. 3D Voronoi
            7. 3D Voronoi fractal
            8. 3D Worley noise
            9. Anisotropic noise
            10. Blue noise fast
            11. BnW spots 1
            12. BnW spots 2
            13. BnW spots 3
            14. Cells 1
            15. Cells 2
            16. Cells 3
            17. Cells 4
            18. Clouds 1
            19. Clouds 2
            20. Clouds 3
            21. Creased
            22. Crystal 1
            23. Crystal 2
            24. Directional noise 1
            25. Directional noise 2
            26. Directional noise 3
            27. Directional noise 4
            28. Directional scratches
            29. Dirt 1
            30. Dirt 2
            31. Dirt 3
            32. Dirt 4
            33. Dirt 5
            34. Dirt gradient
            35. Fluid
            36. Fractal sum 1
            37. Fractal sum 2
            38. Fractal sum 3
            39. Fractal sum 4
            40. Fractal sum base
            41. Fur 1
            42. Fur 2
            43. Fur 3
            44. Gaussian noise
            45. Gaussian spots 1
            46. Gaussian spots 2
            47. Grunge concrete
            48. Grunge Damas
            49. Grunge galvanic large
            50. Grunge galvanic small
            51. Grunge leaks
            52. Grunge leaky paint
            53. Grunge map 001
            54. Grunge map 002
            55. Grunge map 003
            56. Grunge map 004
            57. Grunge map 005
            58. Grunge map 006
            59. Grunge map 007
            60. Grunge map 008
            61. Grunge map 009
            62. Grunge map 010
            63. Grunge map 011
            64. Grunge map 012
            65. Grunge map 013
            66. Grunge map 014
            67. Grunge map 015
            68. Grunge rough dirty
            69. Grunge rust fine
            70. Grunge scratches dirty
            71. Grunge scratches fine
            72. Grunge scratches rough
            73. Grunge shavings
            74. Grunge splashes dusty
            75. Grunge spots
            76. Grunge spots dirty
            77. Liquid
            78. Messy fibers 1
            79. Messy fibers 2
            80. Messy fibers 3
            81. Microscope view
            82. Moisture noise
            83. Perlin noise
            84. Plasma
            85. Caustics
            86. Voronoi
            87. Voronoi fractal
            88. Waveform 1
            89. White noise
            90. White noise fast
          3. Patterns
            1. Patterns
            2. 3D linear gradient
            3. 3D volume mask
            4. Alveolus
            5. Arc pavement
            6. Brick 1
            7. Brick 2
            8. Brick generator
            9. Checker 1
            10. Cube 3D
            11. Cube 3D GBuffers
            12. Fibers 1
            13. Fibers 2
            14. Gaussian 1
            15. Gaussian 2
            16. Gradient axial
            17. Gradient axial reflected
            18. Gradient circular
            19. Gradient linear 1
            20. Gradient linear 2
            21. Gradient linear 3
            22. Gradient radial
            23. Height extrude
            24. Mesh 1
            25. Mesh 2
            26. Panorama shape
            27. Polygon 1
            28. Polygon 2
            29. Scratches generator
            30. Shape
            31. Shape extrude
            32. Shape mapper
            33. Shape splatter
            34. Shape splatter blend
            35. Shape splatter data extract
            36. Shape splatter to mask
            37. Splatter
            38. Splatter circular
            39. Star
            40. Starburst
            41. Stripes
            42. Tile generator
            43. Tile random
            44. Tile random 2
            45. Tile sampler
            46. Triangle grid
            47. Weave 1
            48. Weave 2
            49. Weave generator
        3. Filters
          1. Filters
          2. Adjustments
            1. Adjustments
            2. Apply color palette
            3. Auto levels
            4. Channel mixer
            5. Chrominance extract
            6. Clamp
            7. Color match
            8. Color to mask
            9. Contrast/Luminosity
            10. Convert to linear
            11. Convert to sRGB
            12. Create color palette (16)
            13. Grayscale conversion advanced
            14. Hald CLUT
            15. HDR range viewer
            16. Height map frequencies mapper
            17. Highpass
            18. Histogram compute
            19. Histogram equalize
            20. Histogram range
            21. Histogram render
            22. Histogram scan
            23. Non-uniform histogram scan
            24. Histogram select
            25. Histogram shift
            26. ID to mask grayscale
            27. Invert
            28. Lighting cancel high frequencies
            29. Lighting cancel low frequencies
            30. Luminance highpass
            31. Min max
            32. Modify color palette
            33. Pow
            34. Quantize color (Simple)
            35. Quantize color
            36. Quantize grayscale
            37. Replace color
            38. Replace color range
            39. Threshold
            40. View color palette
          3. Blending
            1. Blending
            2. Color (Blend node)
            3. Color burn
            4. Color dodge
            5. Difference
            6. Dissolve
            7. Linear burn
            8. Luminosity (Blend node)
            9. Multi switch
            10. Switch
          4. Blurs
            1. Blurs
            2. Anisotropic blur
            3. Blur HQ
            4. Non-uniform blur
            5. Radial blur
            6. Slope blur
          5. Channels
            1. Channels
            2. RGBA merge
            3. RGBA split
            4. Alpha merge
            5. Alpha split
            6. Pre-multiplied to straight
            7. Straight to pre-multiplied
          6. Effects
            1. Effects
            2. 3D texture position
            3. 3D texture SDF
            4. 3D texture surface render
            5. 3D texture volume render
            6. Ambient occlusion (HBAO)
            7. Ambient occlusion (RTAO)
            8. Anisotropic Kuwahara color
            9. Anisotropic Kuwahara grayscale
            10. Bevel
            11. Bevel smooth
            12. Cross section
            13. Curvature
            14. Curvature smooth
            15. Curvature sobel
            16. Diffusion color
            17. Diffusion grayscale
            18. Diffusion UV
            19. Directional distance
            20. Edge detect
            21. Emboss with gloss
            22. Extend shape
            23. Flood fill
            24. Flood fill mapper
            25. Flood fill to Bbox size
            26. Flood Fill to gradient
            27. Flood Fill to grayscale/color
            28. Flood Fill to index
            29. Flood Fill to position
            30. Flood Fill to random color
            31. Flood Fill to random grayscale
            32. FXAA
            33. Glow
            34. Mosaic
            35. Multi directional warp
            36. Non-uniform directional warp
            37. Reaction diffusion fast
            38. RT irradiance
            39. RT shadow
            40. Shadows
            41. Shape drop shadow
            42. Shape glow
            43. Shape stroke
            44. Summed area table
            45. Swirl
            46. Uber emboss
            47. Vector morph
            48. Vector warp
          7. Normal map
            1. Normal map
            2. Bent normal
            3. Facing normal
            4. Height normal blender
            5. Height to normal world units
            6. Normal blend
            7. Normal combine
            8. Normal invert
            9. Normal normalize
            10. Normal sobel
            11. Normal to height
            12. Normal to height HQ
            13. Normal transform
            14. Normal uncombine
            15. Normal vector rotation
          8. Tiling
            1. Tiling
            2. Make it tile patch
            3. Make it tile photo
          9. Transforms
            1. Transforms
            2. 3D texture offset
            3. Auto crop
            4. Cartesian to polar
            5. Clone (Filter node)
            6. Mirror (Filter node)
            7. Noise upscale 1
            8. Noise upscale 2
            9. Noise upscale 3
            10. Non-square transform
            11. Non-uniform rotation
            12. Polar to cartesian
            13. Quad transform
            14. Safe transform
            15. Skew
            16. Symmetry
            17. Symmetry slice
            18. Trapezoid transform
        4. Material filters
          1. Material filters
          2. 1-click
            1. 1-Click
            2. Bitmap to material light
          3. Effects (Material)
            1. Effects (Material)
            2. Height blend
            3. Material height blend
            4. Season filter
            5. Snow cover
            6. Water level
          4. Transforms (Material)
            1. Transforms (Material)
            2. Material transform
          5. Blending (Material)
            1. Blending (Material)
            2. Material adjustment blend
            3. Material blend
            4. Material color blend
            5. Material switch
            6. Multi-material blend
          6. PBR utilities
            1. PBR utilities
            2. BaseColor / Metallic / Roughness converter
            3. Base material
            4. PBR Albedo safe color
            5. PBR BaseColor / Metallic validate
            6. PBR Dielectric F0
            7. PBR Metal reflectance
            8. PBR render
            9. PBR render mapping
          7. Scan processing
            1. Scan processing
            2. AO cancellation
            3. Atlas scatter
            4. Atlas splitter
            5. Clone patch
            6. Color equalizer
            7. Crop
            8. Material clone patch
            9. Material crop
            10. Multi-angle to Albedo
            11. Multi-angle to Normal
            12. Multi-clone patch
            13. Multi-color equalizer
            14. Multi-crop
            15. Smart auto tile
        5. Mesh-based generators
          1. Mesh-based generators
          2. Mask generators
            1. Mask generators
            2. Bottom to top
            3. Cloth wear
            4. Dirt
            5. Dripping rust
            6. Dust
            7. Edge blur
            8. Edge damages
            9. Edge dirt
            10. Edge notch
            11. Edge select
            12. Edge speckle
            13. Edge wear
            14. Fiber glass edge wear
            15. Grease
            16. Ground dirt
            17. Leaks
            18. Leather wear
            19. Light
            20. Mask builder
            21. Metal edge eear
            22. Paint wear
            23. Selective dirt
            24. Sun bleach
            25. Surface brush
          3. Weathering
            1. Weathering
            2. Cracks weathering
            3. Fabric weathering
            4. Leather weathering
            5. Metal weathering
            6. Moss weathering
            7. Rock weathering
            8. Rust weathering
          4. Utilities (Mesh-based generators)
            1. Utilities (Mesh-based generators)
            2. 3D planar projection
            3. Material mesh data blender
            4. Material selector
            5. Mesh data combiner
            6. Triplanar
        6. Spline & Path tools
          1. Spline & Path tools
          2. Working with Path & Spline tools
          3. Path tools
            1. Path tools
            2. Paths format specifications
            3. Paths 2D transform
            4. Mask to Ppths
            5. Paths to spline
            6. Paths polygon
            7. Preview paths
            8. Paths warp
            9. Quad transform on path
            10. Paths select
            11. Paths vertex processor
            12. Paths vertex processor simple
          4. Spline tools
            1. Spline tools
            2. Paths to Spline
            3. Point list
            4. Scatter on Spline color
            5. Scatter on Spline grayscale
            6. Spline 2D transform
            7. Spline (Cubic)
            8. Spline (Poly quadratic)
            9. Spline append
            10. Spline bridge (2 Splines)
            11. Spline bridge (List)
            12. Spline bridge mapper color
            13. Spline bridge mapper grayscale
            14. Spline circle
            15. Spline fill
            16. Spline flow mapper
            17. Spline mapper color
            18. Spline mapper grayscale
            19. Spline merge list
            20. Spline render
            21. Spline sample height
            22. Spline sample thickness
            23. Spline select
            24. Spline warp
            25. UV mapper color
            26. UV mapper grayscale
        7. 3D view (Library)
          1. 3D view (Library)
          2. HDRI tools
            1. HDRI tools
            2. Blackbody
            3. Color temperature adjustment
            4. Exposure
            5. Exposure preview
            6. HDR merge
            7. Nadir extract
            8. Nadir patch
            9. Panorama 3D position
            10. Panorama rotation
            11. Gradient 2 points
            12. Gradient linear (HDRI)
            13. Line light
            14. Physical sun/sky
            15. Plane light
            16. Shape light
            17. Sphere light
            18. Straighten horizon
  8. Substance function graphs
    1. Substance function graphs
    2. What is a Substance function graph?
    3. Create and edit a Substance function graph
    4. The Substance function graph
    5. Variables
      1. Variables
      2. Built-in variables
      3. Get a variable value
      4. Create a variable
    6. FX-maps
      1. FX-Maps
      2. How it works
      3. The Iterate node
      4. The Quadrant node
      5. Using Substance function graphs in FX-Maps
        1. Using Substance function graphs
          in FX-Maps
        2. Iterate and $number variable
        3. Using the Sampler nodes
        4. Using the Set/Sequence nodes
    7. Warnings in Substance function graphs
    8. Sample Substance function graphs
    9. Nodes reference for Substance function graphs
      1. Nodes reference for Substance function graphs
      2. Function nodes overview
      3. Constant nodes
      4. Vector and Swizzle nodes
      5. Get nodes
      6. Sampler nodes
      7. Cast nodes
      8. Operator nodes
      9. Logical nodes
      10. Comparison nodes
      11. Function nodes
      12. Control nodes
  9. MDL graphs
    1. MDL graphs
    2. Main MDL graph concepts
    3. Creating an MDL graph
    4. MDL library
    5. Exposing parameters in MDL graphs
    6. Substance graphs and MDL materials
    7. Exporting MDL content
    8. Warnings in MDL graphs
    9. MDL learning resources
  10. Bakers
    1. Bakers
    2. Bakers legacy interface
  11. Best practices
    1. Best practices
    2. Filesize reduction guidelines
    3. Graph creation etiquette
    4. Performance optimization guidelines
  12. Pipeline and project configuration
    1. Pipeline and project configuration
    2. Project configuration files - SBSPRJ
    3. Configuration list - SBSCFG
    4. User preferences - Automating setup
    5. Retrieving the installation path
    6. Environment variables
  13. Color management
    1. Color management
    2. Spot colors (Pantone)
  14. Package metadata
  15. Scripting
    1. Scripting
    2. Plugin basics
    3. Plugin search paths
    4. Plugins packages
    5. Plugin manager
    6. Python editor
    7. Accessing graphs and selections
    8. Nodes and properties
    9. Undo and redo
    10. Application callbacks
    11. Creating user interface elements
    12. Adding actions to the Explorer toolbar
    13. Using color management
    14. Using spot colors
    15. Logging
    16. Using threads
    17. Debugging plugins using Visual Studio Code
    18. Porting previous plugins
    19. Packaging plugins
    20. Scripting API reference
  16. Technical issues
    1. Technical issues
    2. Warnings and errors
    3. Cannot create/load a project
    4. Application does not start
    5. Crash when rendering graphs
    6. Parameters not working as expected
    7. Incorrect image output
    8. 3D View issues
    9. User interface issues
    10. Python issues
    11. Substance model graph feature is missing
  17. Release notes
    1. Release notes
    2. All changes
    3. Version 14.0
    4. Version 13.1
    5. Version 13.0
    6. Version 12.4
    7. Version 12.3
    8. Version 12.2
    9. Version 12.1
    10. Version 11.3
    11. Version 11.2
    12. Version 2021.1 (11.1)
    13. Old versions
      1. Old versions
      2. Version 2020.2 (10.2)
      3. Version 2020.1 (10.1)
      4. Version 2019.3 (9.3)
      5. Version 2019.2 (9.2)
      6. Version 2019.1 (9.1)

Paths Format Specifications

This page describes the Paths format and provides guidance for manipulating data in that format using functions included in the Paths tools.

In this page


Format specifications

This section explains how a Paths document (or image) is encoded:

A Paths document is a list of paths, each of which describes a list of segments, encoded in a 32bit floating-point color texture.

The texture is split into 'top' ($pos.y < 0.5) and 'bottom' ($pos.y > 0.5) parts.

Any data in a pixel in the 'top' part is semantically closely related to the matching pixel in the 'bottom' part, and vice-versa.

Paths Polygon encoded data

Note:

Paths data require 32-bit precision and using lower bitdepth will produce incorrect results.

Therefore, make sure to set the 'Ouptut Format' parameter of nodes generating Paths data to 'HDR High Precision (32F)'.

Let `uv_pos` be a 2D address (such as $pos) of a pixel of the 'top' part.

In the rest of this document:

  • top[uv_pos].XYZW will be referring to the 4 floats stored in the pixel of the top part.
    top[uv_pos] == sample_color(paths, uv_pos)
  • bottom[uv_pos].XYZW will be referring to the 4 floats stored in the matching pixel of the bottom part.
    bottom[uv_pos] == sample_color(paths, uv_pos + Float2(0, 0.5))

top[uv_pos] and bottom[uv_pos] together are forming a semantic unit U[uv_pos] of the document, composed of 8 floats.

Document header

Every Paths document starts with a document header. It is the very first semantic unit U[(0,0)]:

X

The number of paths (should be a positive integer in [0; 16777216]).

If some paths are empty, they still count here. So you can think of it as a 'number of paths headers to decode'.

YZ

The pixel size for this document (I.e., exactly `Float2(1,1) / $size`).

This is useful when reading the Paths from from a Pixel processor or an Fx-Map, for instance, whose Output Size is different.

W

1/16 = 0.0625 (header flag)

XY

The address of the last vertex defined in this document. This is useful to append new data.

It can hence actually be any address that is greater (in scanline order) than the address of the last vertex. It must me in the range ]0, 1[×]0,.5[

ZW

Unused, should be Float2(0, 1)

Path headers

The document header is immediately followed by number-of-paths = top[(0,0)].X path-headers, one by semantic unit.
E.g. if there are 3 paths in the document, they will be stored in U[(0,1)*pixel_size], U[(0,2)*pixel_size] and U[(0,3)*pixel_size] (with pixel_size = top[(0,0)].YZ).

If there are more paths than what one line of pixel can contains, the remaining path-headers are written one the next line(s), in scanline order.
It is allowed to have null path-headers (`top[...].XYZW = Float4(0,0,0,0)`); such path still could as one empty path.

The path-header of the Nth path will be defined at address `path_addr` will be defined as:

X

Number of vertices in this path. Must be in the [0, 16777216] range.

If the start and end vertices of a closed path are at the same position, they still count for 2 vertices.
A path with 0 vertices is a valid path anyway.

Y

Is_closed flag: 1 if the path is closed (e.g. a circle), 0 otherwise (e.g. a straight line).

Z

The path index N.
It must absolutely match path_addr (see note below).

W

The header flag: 1/16 = 0.0625.

XY

Start (or first) vertex address.

ZW

End (or last) vertex' address.

Note:

You can compute `path_addr` from N using the function `Utils/pixel_index_to_position` in paths_tools.sbs: `path_addr = pixel_index_to_position(N+1)`

Vertices information

Vertices can be found anywhere in the image after the headers (document or path headers). Vertices can be of various "types" (Start, Mid or End) and they are explicitly linked together using 2 address pointers ("links").

Start and End vertices are special in this respect: To allow the representation of closed paths or of an arbitrary network of paths linked together, one of the link is actually used to form a circular forward linked list of all the other Start or End vertices that represent the same vertex. Such vertices matching each others are called "siblings". [Illustration welcomed]

Formally, each vertex at address `vert_addr` is defined like this:

XY

The vertex position. Coordinates can be any float value that is not NaN or ±inf. There is no notion of tiling at this level (it can be handle or not by the implementation of each filter), so paths are supposed to be defined on the euclidean plane.

Z

The vertex path index. A vertex can only belong to one Path. (As mentioned earlier, Start and End vertices can have siblings though.) The path index can be used to retrieve the path-header (see Section Path Headers above), so make sure to keep it in sync.

W

Vertex type. It is split between the sign of the value, and its absolute value:

On the sign part, a value of 0 would mean there is no vertex here actually (all other components should be 0 too). A negative value means the vertex is marked as a "corner"; a positive one that the vertex is "smooth". Corner vs. smooth vertex is a pure, isolated attribute and has no impact or meaning on the rest of the Paths encoding.

On the absolute value part, the kind of pixel (Start, Mid or End) and another flag (trivial_link) are encoded:

  • 0.125: End vertex (the last vertex of the shape; always non-trivial links, see below)
  • 0.25: Start vertex (the first vertex of the shape; always non-trivial links, see below)
  • 0.5: Mid vertex with non-trivial links
  • 1: Mid vertex with trivial links

"Trivial links" refers to the fact that the previous and next vertices (in the list of vertices of the current path) are stored in the pixel to left (vert_addr-(0,pixel_size)) and to the right (vert_addr+(0,pixel_size)) respectively, while "non-trivial links" means that at least one of these is stored elsewhere.

Regardless of links "triviality", trustworthy values of links are stored in the bottom part:

XY

The address of the previous vertex of this path. For Start vertices, this points to the next sibling vertex.
if |top[vert_addr].W| = 1, then bottom[vert_addr].XY = vert_addr - (0,pixel_size)

ZW

The address of the next vertex of this path. For End vertices, this points to the next sibling vertex.
if |top[vert_addr].W| = 1, then bottom[vert_addr].ZW = vert_addr + (0,pixel_size)


Reading and writing Paths information

If you want to make your own Paths-processing nodes, you have several tools.

The basics are provided by the Paths Vertex Processor and Paths Vertex Processor Simple nodes, which can basically be used the same way as a Pixel Processor.

If you need features beyond what the Paths Vertex Processor nodes offers (more input textures, or more previous or next vertices), copying the implementation of this graph might be good starting point (assuming you replace the Get("%perVertex") node with you custom processing).

But in case you want to do something more alien than applying a per-vertex function, here is a detailed explanation of the tools you can use. These are usually small helper functions that can be found in the same package as the other Paths nodes (paths_tools.sbs). (These functions are not exposed in the Library and Node menu.)

'Read' functions

Under the `Read` folder, you can find several of these, useful to gather information about the Paths:

Some can give you information about a given pixel. They all take the sampled Float4 value in the *top* part as input. If you look at their implementation, they are super-simple. Their point is to convey more meaning than just atomic nodes:

Check that the current sampled value is either a path header or a document header.

Check the Is_Closed flag (.Y) in a path header. It *assumes you already checked it's a path* with `is_header` and that `current_pixel_is_document_header` returned false.

Check that the current sampled value is a vertex, i.e. not a header, nor an empty pixel.

Check if a *top-part sampled* value is a Start vertex (no need to check `is_vertex` first).

Check if a *top-part sampled* value is a vertex that is not a Start nor End vertex (no need to check `is_vertex` first).

Check if a *top-part sampled* value is an End vertex (no need to check `is_vertex` first).

Short-hand for `is_start_vertex || is_mid_vertex`. More useful for Fx-Map-based processing, to process each segment at most once.

Check the corner flag of the vertex (no need to check `is_vertex` first: if the answer is true, you are on a vertex for sure). Please remind that this flag is somewhat not supported yet by official nodes.

Given the top-part sampled value `sampled` and its position `sampled_position`, returns the next (respectively previous) vertex top-part sampled value, and Set a Float2 variable `next_sampled_pos` to the position (in the top-part) of this neighbor (i.e. <returned value> = SampleColor(next_sampled_pos, image0)). `input0PixSize`must be equal to the path's pixel size (top[(0,0)].YZ).

If the current pixel (`sampled`) is a Start vertex, sample_prev will return the next sibling of this vertex; likewise if it is an End vertex, sample_next will return the next sibling of this vertex (i.e. maybe not what you want). See `sample_next_advanced` and `sample_prev_advanced` below to solve this.

Please note that for simplicity, Paths info are assumed to be stored in input0! Also, unlike what the function's doc states, you don't need to pre-declare `next_sampled_pos`. `[out]next_sampled_pos` is a dummy parameter to remind you that this second "return value" exists.

You can check the `paths_trace` Fx-Map, in the Iterations parameter of the 3rd Iterate node, for an example of how to use it.

Minimal use case of sample_next

Use case of sample_next in Preview Paths (path_trace)

These behave like the matching `sample_next` and `sample_prev` functions above, but it correctly gives you the value and position of the next or previous vertex, even at path extremities (Start or End vertices).

This is aimed to work on closed paths. For open paths, the Start or End vertex doesn't have a sibling, and in this case both functions return the same and only neighbor. For Start or End vertices with more than one sibling (Paths connected as a network), that would return the neighboring vertex of the next sibling in the linked list.

'Write' functions

Under the `Write` folder, you will find small helpers that builds a Float4 ready to be written by an Fx-Map.

Indeed, the Fx-Map multiplies RGB by Alpha before drawing, so the actual values are un-premultiplied to compensate for that. If you want to use these function e.g. in a Pixel Processor, we recommend that you apply the premultiplication yourself again, or that you write a custom version (more optimized for your use case and easier to use).

Builds the top part of the document header, declaring the number of paths you provide.

Builds the *bottom* part of the document header, which specify the last vertex address (see A.1.).

Builds the top part of a path header, according to the number of vertices in the path `nbVertices`, the `isClosed` flag, and the `pathIndex`.

Builds the top part of a vertex, setting the position, type and other options accordingly.

About mid_vertex and the hasTrivialLinks parameter: Ideally you should set the appropriate value, but if for any reason you end up not being able to tell whether links will be trivial or not, you can safely set it to false (at the cost of slower processing of your generated path).

There is no bottom-part builder for path headers nor vertices: both encode two links to the top part, so this function would essentially be a Vector Float4 constructor from two Float2. Don't forget to divide XYZ by W if you are writing using an Fx-Map (W being the Y of an address, it should never be null).

You will find a pertinent example of how to use these functions in the paths_polygon.sbs package hosting the Paths Polygon node.

Methods for processing paths

You will likely use either a Pixel Processor or an Fx-Map to implement your custom processing, each of which has its strength and weaknesses:

The Fx-Map-based solution will usually be preferred when performing high-level operation requiring a global knowledge of the whole path (or paths), or a cumulative one (e.g. repacking vertices after decimation or tessellation). It is also the easiest to approach, so if you are doing a custom processing for the first time, you may want to use a Fx-Map, despite it might be slower.

You need to be familiar with Fx-Map in the first place. If that's not the case, please check the specific documentation.

We recommend that you look at the implementation of Preview Paths in paths_trace.sbs and Paths Polygon in paths_polygon.sbs to get an idea about how to read and write (respectively) path using an Fx-Map.

The Pixel Processor solution will be fitting if you only need "local" information. Here we mean "local" not spatially (the distance between element) but rather topologically (vertices linked together). This is how the Vertex Processor is implemented. The Pixel Processor is usually faster than the Fx-Map for this kind of operation, as each pixel's function is evaluated in parallel, while only a limited amount of data is accessed. Implementation effort might be far more important though, as you can only modify the current pixel.

We won't get into detail, as there is so much to say depending on you specific use case, but the first thing to do is checking where you are:

Are you in the top ($pos.y < 0.5) or bottom ($pos.y > 0.5) part? We recommend that remember that in a dedicated variable (e.g. `isTop`), and that you create a `vert.addr` Float2 those value is `$pos` for the top part, and `$pos - (0,0.5)` for the bottom part.

What is at vert.addr? Sample it and check whether there's anything (W != 0) then, if there is, what exactly. A header (W = 0.0625) (check with `Read/is_header`) or a vertex (check with `Read/is_vertex`)? And if it's a header, is it the document header or a Path header? (You can use `Read/current_pixel_is_document_header` to check that.) Use one or several of the helper functions to match what is interesting to you.

 Adobe

Get help faster and easier

New user?