Divooka Reference

Mesh Materials

9 nodes

On this page 9

Bake Mesh Maps

Function

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.

Signature
BakeMeshMaps -> Mesh Maps
    mesh: MaterialMesh
    size: Integer
    samples: Integer
    occlusionDistance: Number
MeshMapSet BakeMeshMaps(
    MaterialMesh mesh,
    int size = 512,
    int samples = 48,
    double occlusionDistance = 0.25)

Parameters

nametypedefaultdescription
meshMaterialMesh—The model, unwrapped.
sizeInteger512The maps' width and height in pixels.
samplesInteger48Rays per pixel for occlusion and thickness; more is smoother and slower.
occlusionDistanceNumber0.25How far occlusion looks, as a share of the model's size.

Returns

resultMesh Maps
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Load Mesh

Function

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

Signature
LoadMesh(path: Text) -> MaterialMesh
MaterialMesh LoadMesh(string path)

Parameters

nametypedefaultdescription
pathText—The model file.

Returns

resultMaterialMesh
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Mask From Direction

Function

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.

Signature
MaskFromDirection -> Texture
    maps: Mesh Maps
    direction: Facing Direction
    spread: Number
    contrast: Number
Texture MaskFromDirection(
    MeshMapSet maps,
    FacingDirection direction = FacingDirection.Up,
    double spread = 0.5,
    double contrast = 0.5)

Parameters

nametypedefaultdescription
mapsMesh Maps—The baked maps.
directionFacing DirectionUpThe direction that is white.
spreadNumber0.5How far round from the direction the mask reaches, 0 to 1.
contrastNumber0.5How hard its edge is, 0 to 1.

Returns

resultTexture
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Mask From Height

Function

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

Signature
MaskFromHeight -> Texture
    maps: Mesh Maps
    level: Number
    softness: Number
    invert: Truth
Texture MaskFromHeight(
    MeshMapSet maps,
    double level = 0.25,
    double softness = 0.1,
    bool invert = false)

Parameters

nametypedefaultdescription
mapsMesh Maps—The baked maps.
levelNumber0.25The level as a share of the model's height, 0 at its bottom.
softnessNumber0.1How gradual the change is.
invertTruthFalseWhite above the level instead.

Returns

resultTexture
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Mesh Map Channels

Function

The individual baked maps.

Signature
MeshMapChannels(maps: Mesh Maps) -> (result: Texture, curvature: Texture, position: Texture, worldNormal: Texture, thickness: Texture, partId: Texture)
Texture MeshMapChannels(
    MeshMapSet maps,
    out Texture curvature,
    out Texture position,
    out Texture worldNormal,
    out Texture thickness,
    out Texture partId)

Parameters

nametypedefaultdescription
mapsMesh Maps—The baked maps.

Returns

resultTexture
curvatureTexture
positionTexture
worldNormalTexture
thicknessTexture
partIdTexture
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Preview On Mesh

Function

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

Signature
PreviewOnMesh -> Pixel Image
    mesh: MaterialMesh
    material: PBR Material
    environment: PreviewEnvironment
    size: Integer
    rotation: Number
    relief: PreviewRelief
PixelImage PreviewOnMesh(
    MaterialMesh mesh,
    PbrMaterial material,
    PreviewEnvironment environment = PreviewEnvironment.Studio,
    int size = 512,
    double rotation = 30,
    PreviewRelief relief = PreviewRelief.Parallax)

Parameters

nametypedefaultdescription
meshMaterialMesh—The model.
materialPBR Material—The material, in the model's texture coordinates (from a layer stack or a triplanar projection).
environmentPreviewEnvironmentStudioThe lighting.
sizeInteger512The picture's width and height in pixels.
rotationNumber30Turns the model, in degrees.
reliefPreviewReliefParallaxHow the material's height shows. Parallax works on any model; displacement moves the model's own vertices, so it needs a finely divided one.

Returns

resultPixel Image
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Sample Mesh

Function

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.

Signature
SampleMesh(shape: PreviewShape, detail: Integer) -> MaterialMesh
MaterialMesh SampleMesh(
    PreviewShape shape = PreviewShape.RoundedBox,
    int detail = 64)

Parameters

nametypedefaultdescription
shapePreviewShapeRounded boxThe shape.
detailInteger64How finely it is divided.

Returns

resultMaterialMesh
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Triangle Count

Function

How many triangles a mesh has.

Signature
TriangleCount(mesh: MaterialMesh) -> Integer
int TriangleCount(MaterialMesh mesh)

Parameters

nametypedefaultdescription
meshMaterialMesh—The mesh.

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing

Triplanar Project

Function

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.

Signature
TriplanarProject -> PBR Material
    material: PBR Material
    maps: Mesh Maps
    tileMetres: Number
    sharpness: Number
PbrMaterial TriplanarProject(
    PbrMaterial material,
    MeshMapSet maps,
    double tileMetres = 0.5,
    double sharpness = 4)

Parameters

nametypedefaultdescription
materialPBR Material—The tiling material.
mapsMesh Maps—The model's baked maps.
tileMetresNumber0.5The width one tile covers on the model, in metres.
sharpnessNumber4How narrow the blend between sides is: 1 soft, 8 nearly hard.

Returns

resultPBR Material
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Mesh Materials
Package
Image Processing