元編程參考文件

網格材質

9 個節點

本頁內容 9

烘焙網格貼圖

函數

Bakes a model's maps into its texture coordinates: ambient occlusion and thickness by tracing rays against the model, curvature from how its surface bends, and its position, world-space normal and parts.

簽名
烘焙網格貼圖 -> Mesh Maps
    網格: MaterialMesh
    尺寸: 整數
    取樣數: 整數
    遮蔽距離: 數字
MeshMapSet BakeMeshMaps(
    MaterialMesh mesh,
    int size = 512,
    int samples = 48,
    double occlusionDistance = 0.25)

參數

名稱型別預設值說明
網格MaterialMesh—The model, unwrapped.
尺寸整數512The maps' width and height in pixels.
取樣數整數48Rays per pixel for occlusion and thickness; more is smoother and slower.
遮蔽距離數字0.25How far occlusion looks, as a share of the model's size.

返回

結果Mesh Maps
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

載入網格

函數

A model read from an OBJ, glTF or GLB file: its triangles, normals and first texture coordinates. It must already be unwrapped.

簽名
載入網格(路徑: 文字) -> MaterialMesh
MaterialMesh LoadMesh(string path)

參數

名稱型別預設值說明
路徑文字—The model file.

返回

結果MaterialMesh
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

按朝向生成蒙版

函數

A mask from which way the model's surface faces: white where it faces the direction, falling off over the spread. Moss and snow on upward faces, drips under overhangs.

簽名
按朝向生成蒙版 -> Texture
    烘焙貼圖: Mesh Maps
    方向: Facing Direction
    展開範圍: 數字
    對比度: 數字
Texture MaskFromDirection(
    MeshMapSet maps,
    FacingDirection direction = FacingDirection.Up,
    double spread = 0.5,
    double contrast = 0.5)

參數

名稱型別預設值說明
烘焙貼圖Mesh Maps—The baked maps.
方向Facing Direction上The direction that is white.
展開範圍數字0.5How far round from the direction the mask reaches, 0 to 1.
對比度數字0.5How hard its edge is, 0 to 1.

返回

結果Texture
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

按高度生成蒙版

函數

A mask from height on the model: white below a level, black above, softened - rising damp, mud splashed at a base, a tide line.

簽名
按高度生成蒙版 -> Texture
    烘焙貼圖: Mesh Maps
    水位: 數字
    柔和度: 數字
    反轉: 真否
Texture MaskFromHeight(
    MeshMapSet maps,
    double level = 0.25,
    double softness = 0.1,
    bool invert = false)

參數

名稱型別預設值說明
烘焙貼圖Mesh Maps—The baked maps.
水位數字0.25The level as a share of the model's height, 0 at its bottom.
柔和度數字0.1How gradual the change is.
反轉真否FalseWhite above the level instead.

返回

結果Texture
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

網格貼圖通道

函數

The individual baked maps.

簽名
網格貼圖通道(烘焙貼圖: Mesh Maps) -> (結果: Texture, 曲率: Texture, 位置: Texture, 世界法線: Texture, 厚度: Texture, 部件編號: Texture)
Texture MeshMapChannels(
    MeshMapSet maps,
    out Texture curvature,
    out Texture position,
    out Texture worldNormal,
    out Texture thickness,
    out Texture partId)

參數

名稱型別預設值說明
烘焙貼圖Mesh Maps—The baked maps.

返回

結果Texture
曲率Texture
位置Texture
世界法線Texture
厚度Texture
部件編號Texture
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

在網格上預覽

函數

A material rendered on a model, the camera placed to fit the model.

簽名
在網格上預覽 -> Pixel Image
    網格: MaterialMesh
    材質: PBR Material
    環境: PreviewEnvironment
    尺寸: 整數
    旋轉: 數字
    起伏: PreviewRelief
PixelImage PreviewOnMesh(
    MaterialMesh mesh,
    PbrMaterial material,
    PreviewEnvironment environment = PreviewEnvironment.Studio,
    int size = 512,
    double rotation = 30,
    PreviewRelief relief = PreviewRelief.Parallax)

參數

名稱型別預設值說明
網格MaterialMesh—The model.
材質PBR Material—The material, in the model's texture coordinates (from a layer stack or a triplanar projection).
環境PreviewEnvironment攝影棚The lighting.
尺寸整數512The picture's width and height in pixels.
旋轉數字30Turns the model, in degrees.
起伏PreviewRelief視差How the material's height shows. Parallax works on any model; displacement moves the model's own vertices, so it needs a finely divided one.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

示例網格

函數

One of the sample shapes, unwrapped so that every point of its surface has its own texture coordinates: a model to bake and texture without leaving the graph.

簽名
示例網格(形狀: PreviewShape, 細分程度: 整數) -> MaterialMesh
MaterialMesh SampleMesh(
    PreviewShape shape = PreviewShape.RoundedBox,
    int detail = 64)

參數

名稱型別預設值說明
形狀PreviewShape圓角立方體The shape.
細分程度整數64How finely it is divided.

返回

結果MaterialMesh
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

三角形數

函數

How many triangles a mesh has.

簽名
三角形數(網格: MaterialMesh) -> 整數
int TriangleCount(MaterialMesh mesh)

參數

名稱型別預設值說明
網格MaterialMesh—The mesh.

返回

結果整數
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理

三平面投射

函數

Projects a tiling material onto a model from three sides (triplanar), so it needs no seams in the model's own layout: each side of the model takes the projection facing it, blended where they meet. The result is laid out in the model's texture coordinates, ready for a layer stack.

簽名
三平面投射 -> PBR Material
    材質: PBR Material
    烘焙貼圖: Mesh Maps
    單塊尺寸(米): 數字
    銳利度: 數字
PbrMaterial TriplanarProject(
    PbrMaterial material,
    MeshMapSet maps,
    double tileMetres = 0.5,
    double sharpness = 4)

參數

名稱型別預設值說明
材質PBR Material—The tiling material.
烘焙貼圖Mesh Maps—The model's baked maps.
單塊尺寸(米)數字0.5The width one tile covers on the model, in metres.
銳利度數字4How narrow the blend between sides is: 1 soft, 8 nearly hard.

返回

結果PBR Material
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
網格材質
所屬包
影像處理