Materials
The puzzles from this category perform various operations with materials and textures.

Contents
Puzzles Reference
assign material
Assigns a material to an object, completely replacing the old material. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

This puzzle requires a material which must be assigned to some existing model (can be hidden), kinda a swatch card:

Also, the source and destination meshes should have the same layout for UVs and color attributes, e.g in Blender:

In some situations, namely when a normal-mapped material is assigned to an object without normal mapping, this puzzle might render your material completely black. If this happens, disable mesh attributes optimization in the export settings:



replace texture
Replaces a texture found for a specified material with the one loaded from the provided image URI, video asset, or canvas.

Puzzle options:
- enable "once ready do" slot
- Show/hide the slot for puzzles which will be executed right after the texture is done loading.
- flexible texture input
- Allow using text puzzles inside the "texture" input instead of the default dropdown selector.
For usage example, check out the Custom Image demo (source files available in the Asset Store).
To use transparent videos, encode your content in WebM or HEVC format and set the material type to Blend (see: transparency in Blender / Max / Maya).
get texture param
Retrieves the following parameters for a texture found for a specified material: width, height, aspect or dimensions.

set color
Set R, G and B components of a color parameter found for a specified material.

You can add RGB nodes in your node-based materials and their names will be shown in the dropdown menu. In addition, Base Color (or Color) inputs for BSDF Principled, BSDF Diffuse and BSDF Glossy nodes are also accessible.

In case of glTF-compliant PBR materials, the BaseColor and Emissive inputs are only accessible with this puzzle.
You can add Controllers in your materials (standard or physical) and their names will be shown in the dropdown menu. In addition, Diffuse (or Base Color) color inputs for standard or physical material nodes are also accessible.

In case of glTF-compliant PBR materials, the Base Color and Emission inputs are only accessible with this puzzle.
You can add Color Constant nodes in your materials and their names will be shown in the dropdown menu.

In case of glTF-compliant PBR materials, the color and emissive inputs are only accessible with this puzzle.
This puzzle can also be used to modify the environment shader. In the drop-down, the name of the environment shader starts with "Verge3D_Environment".
For more information on materials available to Verge3D users, please refer to Material system overview chapters of this manual: Blender, 3ds Max, Maya.
get color
Get color parameter found for a specified material:
- red - red color component.
- green - green color component.
- blue - blue color component.
- rgb - RGB color components as vector/list value.
- css (hex) - CSS style string, such as #AA00FF.
- css (rgb) - CSS style string, such as rgb(127, 0, 255).
Specify flexible color input parameter to assign custom material parameter as string value.

set value
Set a value parameter found for a specified material.

You can add Value nodes in your node-based materials and their names will be shown in the dropdown menu.

In case of glTF-compliant PBR materials, the following inputs are accessible with this puzzle: metalness, roughness, bumpScale, emissiveIntesity, and envMapIntensity.
You can add Controllers in your materials (standard or physical) and their names will be shown in the dropdown menu.

In case of glTF-compliant PBR materials the following inputs are accessible with this puzzle: Metalness, Roughness, Bump Scale, Emissive Intensity and Environment Map Intensity.
You can add Float Constant nodes in your material and their names will be shown in the dropdown menu.

In case of glTF-compliant PBR materials, the following inputs are accessible with this puzzle: metalness, roughness, bumpScale, emissiveIntensity and envMapIntensity.
This puzzle can also be used to modify the environment shader. In the drop-down, the name of the environment shader starts with "Verge3D_Environment".
For more information on materials available to Verge3D users, please refer to Material system overview chapters of this manual: Blender, 3ds Max, Maya.
get value
Get a value parameter found for a specified material. Specify flexible value input parameter to assign custom material parameter as string value.

material from
Retrieves the name of a material assigned to an object. By default, if multiple materials are assigned to the same object, returns the first one.

This puzzles supports additional options which can be activated via the gear icon:

- multi-material index
- By default the "material from" puzzle does not support multi-material meshes and returns the first one found. Enable multi-material index and specify the index input (e.g. material slot number from Blender) to get the required material from a multi-material mesh.
- return unique material id
- By default the "material from" puzzle returns a human-readable material name. However in some situations, such as similar-named and/or shared materials, you may want to pick the material of a single object, rather than update them all at once. For that you can enable the return unique material id checkbox so that this puzzle returns a unique material identifier, instead of its name. You can use this ID (which looks like this: 5c464bf0-043a-40ee-b864-5c026436d7de) to pass it into other material puzzles.
texture from text
Creates an image from specified text and returns it in Data URL format.

Parameters:
- text
- Input text.
- width, height
- Dimensions of the generated image (in pixels). Power-of-two values are recommended (256, 512, 1024 etc).
- font family
- font-family CSS property to render the text with. You can use system fonts such as "Arial" or custom fonts loaded with the load font puzzle.
- size
- Size of the text drawn on the generated image (in pixels).
- horizontal align
- How the text is horizontally aligned on the generated image: center, left, right.
- vertical align
- How the text is vertically aligned on the generated image: middle, top, bottom.
- line height
- Line height of the text (in pixels). If set to 0, it is auto-detected.
- justify
- Justify the text if enabled, inserts spaces between words when necessary.
Box parameters (activated via "gear" icon):
When activated, the text rendered inside a box container the size and position of which can be tweaked using the following parameters:
- box x
- Box left edge (in pixels).
- box y
- Box top edge (in pixels).
- width
- Box width (in pixels).
- height
- Box height (in pixels).
Color parameters (activated via "gear" icon):
- text color
- The color of the text.
- background color
- The color of the background.
In the example below, the image generated from text is used on a model via the replace texture puzzle:

color picker
Return selected color as CSS value.

compose color
Compose color from linear RGB (or RGBA with alpha input enabled) components and return it as CSS value.

generate normal map
Converts an image to normal map and returns it in Data URL format.

Parameters:
- (source image)
- image URL, usually black and white height map. Also images in Data URL format can be supplied such as the output of the texture from text puzzle.
- strength
- linear factor affecting the height. Recommended values: 0.01 to 5.
- level
- exponential factor affecting the height. Recommended values: 4 to 10.
- blur / sharp
- blurriness/sharpness factor in the Gaussian filter. Recommended values: -10 (blur) to 10 (sharp).
- filter
- selector between Sobel or Scharr algorithms used for edge detection.
- invert R
- invert direction in the normal map's R channel. At the moment this must be disabled for Blender, 3ds Max, and Maya but may require enabling for some other tool supported in the future.
- invert G
- invert direction in the normal map's G channel. Must be enabled for compatibility with 3ds Max’ normal map space but left disabled for Blender/Maya.
- invert height
- change interpretation of height to make darker pixels correspond to lower height.
In the example below, the normal map generated from a loaded image is used on a model via the replace texture puzzle:

enable/disable wireframe
Enable or disable wireframe rendering for a specified material. Can be used as a non-photorealistic rendering technique, for debugging, or performance optimization.

Having Troubles with Puzzles?
Seek help on the forums!