nel_material_parameters - ryzom/ryzomcore GitHub Wiki


title: NeL Material Parameters description: Reference of the script-level parameter set of the NeL Material: every parameter by rollout with its type, default, range, script version and effect at export; the shader types, presets, texture slot model and the differences between script versions 14 and 15 published: true date: 2026-11-29T00:00:00.000Z tags: editor: markdown dateCreated: 2026-11-29T00:00:00.000Z

This page lists the parameters of the NeL Material as the NeL Material script defines them (script version 15, with version 14 where it differs), and what each does when a material is built for NeL. The list is the parameter catalogue of the NeL Material library (nel/tools/3d/nel_material, material_catalogue.cpp). The same table drives the panels of the NeL Material Editor, the readers and writers of .max files, the sidecar codec of NeL-Specific glTF Extras and the tests, so nothing else lists parameters.

Everything on this page describes code that exists, except the paragraphs marked Designed. A paragraph says so where the headless exporter and the reference exporter plugin differ.

Conventions

Term Meaning
Script-level The parameters an artist edits in the rollouts of the NeL Material, as stored in the .max file, not the built NeL material. The built material is derived from them (buildMaterial in material_build.cpp, shared by the headless shape exporter and the editor).
Types boolean, integer, float, percent, color, texturemap, the script's own type names.
Percent Stored as a fraction from 0 to 1 and shown in percent by the spinner. Defaults and ranges on this page are written in percent.
Colour Three floats from 0 to 1 in the .max file. Defaults on this page are written as 8-bit values; the sidecar stores rrggbb hex.
Drop-down The stored value is the 1-based index of the item. The lists are under Drop-down lists.
Default The default the script declares. The nlbp block declares none: the script copies the values from the Standard material that sits inside every NeL material when it creates one. The default shown for these ten parameters is the initial value of the rollout's control, which is what the editor gives a new material.
Range The range of the control, in stored units. Where a cell is empty the control has none.
Since The script version that first has the parameter: the script's own "new in version" comments where it has them, otherwise the oldest kept backup of the script that holds the parameter (the kept backups are versions 1, 2, 3, 5, 11 and 14; what changed between them is not recorded).
At export What the build does with the value. A parameter that the file does not store as a constant (it carries an animation controller, or is absent) is not read at tick 0: the exporter takes its fallback instead, see Export fallbacks.
Headless exporter The shape exporter of the pipeline (pipeline_max_export_shape), which reads .max files without the modelling program.
Reference exporter plugin The export plugin for the modelling program that the headless exporter reproduces.

The material also holds a Standard material (the "delegate") that the script keeps in step with the colour parameters and the first two texture slots, so that the modelling program shows the same look. The delegate is not part of the catalogue.

NeL Basic Parameters (nlbp)

The rollout "NeL Basic Parameters" (open by default). Block nlbp, script version 12 and later. The controls show percent values and 8-bit colours.

Parameter Shown as Type Default Range Since At export
bTwoSided 2-Sided boolean false 12 Two-sided drawing (setDoubleSided).
cAmbient Ambient color [63, 63, 63] 12 Ambient colour, 8 bits per channel (value x 255 + 0.5, clamped).
cDiffuse Diffuse color [127, 127, 127] 12 Lit material: the diffuse colour. Unlit material: its colour and diffuse. The alpha comes from pOpacity.
pOpacity Opacity percent 100 % 0 to 100 % 12 Alpha of the diffuse colour (value x 255 + 0.5, clamped); an unlit material keeps it in the alpha of its colour.
cSpecular Specular color [255, 255, 255] 12 Specular colour, multiplied by pSpecularLevel.
pSpecularLevel Level percent 0 % 0 to 100 % 12 Factor (clamped to 0..1) on the specular colour.
pGlossiness Glossiness percent 10 % 0 to 80 % 12 Shininess = 2^(10 x value) x 4: 0 % gives 4, 10 % gives 8, 50 % gives 128, 80 % gives 1024. The control stops at 80 %.
cSelfIllumColor Self Illum color [0, 0, 0] 12 Emissive colour when bUseSelfIllumColor is set.
pSelfIllumAmount Self Illum percent 0 % 0 to 100 % 12 Emissive colour = diffuse x amount when bUseSelfIllumColor is not set (black when the diffuse is not a stored constant).
bUseSelfIllumColor Use Color boolean false 12 Chooses the emissive source: the colour, or the diffuse scaled by the amount.

The self illumination colour control is shown only when bUseSelfIllumColor is set, the amount control only when it is not.

NeL Material (main)

The rollout "NeL Material". Block main: 42 parameters in version 15, 37 in version 14.

Shader

Parameter Shown as Type Default Range Since At export
iShaderType Shaders Type integer 1 1 to 8 4 Chooses the NeL shader (see Shader types). Set it only together with the derived flags.

The shader type must be written together with the derived flags, see Derived flags.

Light

Parameter Shown as Type Default Range Since At export
bUnlighted Unlighted boolean false 2 Unlit material instead of lit (initUnlit); always unlit under the LightMap shader.
bStainedGlassWindow Lightmap stained glass window boolean false 2 Stained glass flag of the built material (setStainedGlassWindow). The material's serial stream does not carry it; the lightmap ray tracer reads it.
bColorVertex Color Vertex boolean false 3 setLightedVertexColor(lit and value). The mesh build reads the vertex colours of map channel 0 for the faces of the material and multiplies every vertex colour by the diffuse (lit) or the colour (unlit), the alpha by the opacity.
iLightMapChannel Lightmap Texture Channel integer 2 0 to 99 4 LightMap shader: the map channel of the extra UV set that carries the lightmap coordinates; slot 1's channel is used when the mesh has no such channel.

Alpha

The buttons "Setup Blend", "Setup Additive" and "Setup Alpha Additive" belong to this group, see Presets.

Parameter Shown as Type Default Range Since At export
bAlphaTest Alpha Test boolean false 2 Alpha test (setAlphaTest); the threshold stays at the NeL default, 0.5.
bAlphaVertex Alpha Vertex boolean false 3 With alpha blending or alpha test: the mesh's vertex alpha is taken from a map channel (see iAlphaVertexChannel). Off under the Water and LightMap shaders.
iAlphaVertexChannel Alpha Vertex Channel integer 0 0 to 99 3 The map channel whose colour gives the vertex alpha: (R + G + B) / 3, multiplied by the opacity.
bAlphaBlend Alpha Blend boolean false 4 Alpha blending (setBlend).
iBlendSrcFunc Blend Source integer 1 1 to 10 4 setSrcBlend(value - 1). The Water and LightMap shaders force Source Alpha.
iBlendDestFunc Blend Destination integer 1 1 to 10 4 setDstBlend(value - 1). The Water and LightMap shaders force Inverse Source Alpha.

Z buffer

Parameter Shown as Type Default Range Since At export
bForceZWrite Force ZWrite boolean false 2 With alpha blending on: the material writes the Z buffer (setZWrite(value)).
bForceNoZWrite Force No ZWrite boolean false 2 With alpha blending off: the material does not write the Z buffer when set (setZWrite(!value)).
fZBias ZBias : float 0 -100 to 100 4 setZBias.

Water

These parameters take effect only under the Water shader. The artist-facing meaning of each one is on Creating Water Surfaces.

Parameter Shown as Type Default Range Since At export
bWaterUseSceneEnvMapAbove Use scene envmap above water boolean false 11 Water shape: setUseSceneWaterEnvMap(0). The headless exporter writes false (see below).
bWaterUseSceneEnvMapUnder under water boolean false 11 Water shape: setUseSceneWaterEnvMap(1). The headless exporter writes false (see below).
fBumpUScale BumpMap Scale U float 0.01 -10 to 10 2 Water shape: setHeightMapScale(1).x (bump map). Read by both exporters.
fBumpVScale BumpMap Scale V float 0.01 -10 to 10 2 Water shape: setHeightMapScale(1).y (bump map). Read by both exporters.
fBumpUSpeed BumpMap Speed U float 0.01 -10 to 10 2 Water shape: setHeightMapSpeed(1).x (bump map). Read by both exporters.
fBumpVSpeed BumpMap Speed V float 0.01 -10 to 10 2 Water shape: setHeightMapSpeed(1).y (bump map). Read by both exporters.
fDisplaceMapUScale DisplaceMap Scale U float 0.005 -10 to 10 2 Water shape: setHeightMapScale(0).x (displace map). Read by both exporters.
fDisplaceMapVScale DisplaceMap Scale V float 0.005 -10 to 10 2 Water shape: setHeightMapScale(0).y (displace map). Read by both exporters.
fDisplaceMapUSpeed DisplaceMap Speed U float 0.005 -10 to 10 2 Water shape: setHeightMapSpeed(0).x (displace map). Read by both exporters.
fDisplaceMapVSpeed DisplaceMap Speed V float 0.005 -10 to 10 2 Water shape: setHeightMapSpeed(0).y (displace map). Read by both exporters.
fWaterHeightFactor Water height factor float 1 0 to 1000 5 Water shape: setWaveHeightFactor. Read by both exporters.
iWaterPoolID Water pool ID integer 0 0 to 3 5 Water shape: setWaterPoolID. Read by both exporters.
bCalcWaterLightmap Compute water lightmap boolean false 7 Read by no exporter; the editor greys the control ("not used by the exporter").
bEnableWaterSplash Enable water splash boolean true 10 Water shape: enableSplash. The headless exporter does not read it; the shape keeps its default (on).
bWaterRealtimeReflection Realtime planar reflection boolean false 15 Water shape: enableRealtimeReflection. The headless exporter does not read it (see below).
bWaterEnvMapCalcReflectivity Calc reflectivity on envmap boolean false 15 Water shape: enableEnvMapCalcReflectivity. The headless exporter does not read it.
fWaterFresnelBias Reflectivity fresnel, bias float 0.15 0 to 1 15 Water shape: first value of setReflectivityFresnel. The headless exporter does not read it.
fWaterFresnelScale Reflectivity fresnel, scale float 0.85 0 to 2 15 Water shape: second value of setReflectivityFresnel. The headless exporter does not read it.
fWaterFresnelPower Reflectivity fresnel, power float 2 0.1 to 8 15 Water shape: third value of setReflectivityFresnel. The headless exporter does not read it.

Who reads the water parameters:

  • The reference exporter plugin reads all of them, by name, when it builds a water shape.
  • The headless exporter's water builder (water_build.cpp) reads the bump and displace scales and speeds, fWaterHeightFactor and iWaterPoolID, by the version 14 parameter ids (these ids are the same in version 15). It sets both scene environment map flags to false, leaves the splash flag at the shape's default (on), and does not read bWaterRealtimeReflection, bWaterEnvMapCalcReflectivity or the three fresnel values: the shape keeps its defaults, 0.15, 0.85 and 2.0, with both reflection flags off. Its source notes that the corpus is version 14, which has none of these parameters.
  • A water shape is built from the values stored in the file. The Material Editor derives the water shape its view shows from that build with the current parameters, by the rules of the headless water builder, so the edits of the parameters that builder reads show in the view; with the unedited parameters the derived shape is the built one byte for byte.
  • bCalcWaterLightmap is read by no exporter. CWaterShape has a lightmapping switch and the zone lighter reads it, but nothing writes it from the material.

Extended

Parameter Shown as Type Default Range Since At export
cUserColor User Color color [255, 0, 255] 4 UserColor shader only: setUserColor.
bExportTextureMatrix Export texture matrix boolean false 5 Every enabled slot that holds a texmap gets a user texture matrix built from its placement, which is what the texture matrix animation moves (see Texture slot model).

Derived flags

These six parameters have no control. The script recomputes them from iShaderType when its rollout refreshes; a tool that writes a material must write them together with iShaderType.

Parameter Shown as Type Default Range Since At export
bLightMap no control boolean false 1 Derived from the shader type (4). The build does not read it; the script and the reference exporter plugin test it.
bWater no control boolean false 2 Derived from the shader type (6). A node whose single material has it set becomes a water shape instead of a mesh.
bUserColor no control boolean false 4 Derived from the shader type (3). Not read by the build.
bSpecular no control boolean false 4 Derived from the shader type (5). Not read by the build.
bNormalShader no control boolean false 4 Derived from the shader type (1). Not read by the build.
bPerPixelLightingShader no control boolean false 11 Derived from the shader type (7 and 8). Not read by the build.

NeL Textures (textures)

The rollout "NeL Textures": the eight texture slots, and the "Setup Stage" group that applies a preset (see Presets). Block textures: 24 parameters, the same in versions 14 and 15.

Parameter Shown as Type Default Since At export
bEnableSlot_1 to bEnableSlot_8 Texture N (the caption changes with the shader type) boolean false 4 The slot is built only when enabled and when it holds a texmap, and only for the slots the shader exports (see Shader types).
bTexGen_1 to bTexGen_8 EnvMap boolean false 4 The stage takes reflection texture coordinates instead of a UV channel (setTexCoordGen, default mode reflect). Editable for slots 1 to 4 under the Normal shader only.
tTexture_1 to tTexture_8 the map button texturemap none 4 The texmap of the slot; see Texture slot model.

The drop-down of the "Setup Stage" group is the parameter iShader of the main block:

Parameter Shown as Type Default Range Since At export
iShader Setup Stage drop-down integer 1 1 to 6 4 Not exported. Remembers the choice of the Setup Texture Slots drop-down.

The caption of each "Texture N" check box shows the role of the slot under the current shader type, see Shader types.

NeL Slot 1 to NeL Slot 4 (slot1 to slot4)

Four rollouts, one per combiner stage; the stage index is the slot number minus one. Block slotN: 19 parameters each, the same in versions 14 and 15. A parameter name ends with _N, the slot number.

Parameter Shown as Type Default Range Since (slots 1, 2 / 3, 4) At export (only under the Normal shader)
cConstant_N Constant Color (Extended) color [255, 255, 255] 4 / 7 RGB of the stage's constant colour (texConstantColor); the alpha is iConstantAlpha_N.
iRgbOperation_N Operation (RGB) integer 1 1 to 6 4 / 7 Items 1 to 4: Replace, Modulate, Add, AddSigned (value - 1); 5: interpolation with the source of iRgbBlendSource_N (InterpolateTexture, Previous, Diffuse or Constant); 6: Mad.
iRgbBlendSource_N Blend Source (RGB) integer 1 1 to 4 4 / 7 Used by operation 5 only: the source that weights the interpolation.
iRgbArg0_N Arg0 (RGB) integer 1 1 to 4 (5, see below) 4 / 7 Source of Arg0 (value - 1: Texture, Previous, Diffuse, Constant). The fifth item, where a list has one, builds as Texture.
iRgbArg1_N Arg1 (RGB) integer 1 1 to 4 4 / 7 Source of Arg1: items 1 to 3 are Previous, Diffuse, Constant (value), item 4 is Texture.
iRgbArg2_N Arg2 (RGB) integer 1 1 to 4 11 / 11 Source of Arg2, as Arg1; used by operation 6 (Mad).
iRgbArg0Operand_N Oper0 (RGB) integer 1 1 to 4 4 / 7 Operand of Arg0 (value - 1: colour, inverse colour, alpha, inverse alpha).
iRgbArg1Operand_N Oper1 (RGB) integer 1 1 to 4 4 / 7 Operand of Arg1, as Arg0.
iRgbArg2Operand_N Oper2 (RGB) integer 1 1 to 4 11 / 11 Operand of Arg2, as Arg0; used by operation 6.
iAlphaOperation_N Operation (Alpha) integer 1 1 to 6 4 / 7 As iRgbOperation_N, for the alpha channel.
iAlphaBlendSource_N Blend Source (Alpha) integer 1 1 to 4 4 / 7 As iRgbBlendSource_N, for the alpha channel.
iAlphaArg0_N Arg0 (Alpha) integer 1 1 to 4 (5, see below) 4 / 7 As iRgbArg0_N, for the alpha channel.
iAlphaArg1_N Arg1 (Alpha) integer 1 1 to 4 4 / 7 As iRgbArg1_N, for the alpha channel.
iAlphaArg2_N Arg2 (Alpha) integer 1 1 to 4 11 / 11 As iRgbArg2_N, for the alpha channel.
iAlphaArg0Operand_N Oper0 (Alpha) integer 3 1 to 4 4 / 7 Operand of the alpha Arg0. NeL stops on RGB and Inverse RGB here: only Alpha and Inverse Alpha are valid.
iAlphaArg1Operand_N Oper1 (Alpha) integer 3 1 to 4 4 / 7 As iAlphaArg0Operand_N, for Arg1.
iAlphaArg2Operand_N Oper2 (Alpha) integer 3 1 to 4 11 / 11 As iAlphaArg0Operand_N, for Arg2.
iTextureShader_N Texture Shader (Extended) integer 1 1 to 16 4 / 7 Items above 1 switch texture addressing on (enableTexAddrMode, which sets every stage to TextureOff) and set this stage to mode value - 2.
iConstantAlpha_N Constant Alpha (Extended) integer 255 0 to 255 4 / 7 Alpha of the stage's constant colour.

Notes on the table:

  • Slots 1 and 2 are "new in version 4" and slots 3 and 4 "new in version 7" in the script. The four Arg2 parameters of each slot (iRgbArg2_N, iRgbArg2Operand_N, iAlphaArg2_N and iAlphaArg2Operand_N, for the Mad operation) first appear in the version 11 backup and are shown as since 11 in all four slots.
  • Some Arg0 lists have a fifth item, Texture: the RGB list of slots 2 and 4, and the alpha list of slots 1, 3 and 4. The build writes the value 4 for it into a 2-bit field of the stage environment, which wraps to Texture.
  • The label of iRgbArg1Operand_N is "Oper1 Operand" in slot 1 and "Oper1" in the others.
  • The script's NeL Slot 4 rollout shows the Arg1 values in its Arg2 drop-downs and writes them to the Arg2 parameters when a control changes. The editor's Arg2 controls edit the Arg2 parameters (see Differences between the script and the editor).
  • The combiner of all four stages is built whenever the shader is Normal, enabled or not; a stage is active at run time only when it has a texture. At stage 0 Previous is the same as Diffuse.
  • The alpha arguments accept only the operands Alpha and Inverse Alpha. NeL stops on RGB and Inverse RGB there; the editor refuses such a value before building.

Drop-down lists

List (parameters) Items, with the stored value in front
Shader type (iShaderType) 1 Normal (simple multitexture material); 2 Not Implemented (do not use, bump material not implemented); 3 UserColor (display user color on texture inverse alpha); 4 LightMap (material used for lightmapping); 5 Specular (material with specular reflection cubemap); 6 Water (shiny water shader); 7 Per pixel lighting, require one texmap applied; 8 Per pixel lighting, no specular, require one texmap applied
Blend factor (iBlendSrcFunc, iBlendDestFunc) 1 One; 2 Zero; 3 Source Alpha; 4 Inverse Source Alpha; 5 Source RGBA; 6 Inverse Source RGB; 7 Constant Color; 8 Inverse Constant Color; 9 Constant Alpha; 10 Inverse Constant Alpha
Setup Stage (iShader) 1 Single Texture (RGBA1) (A1); 2 Addition Two Textures (RGB1+RGB2) (A2); 3 Multiply Two Textures (RGB1*RGB2) (A2); 4 Blend Two Textures (RGB1*(1-A1)+RGB2*A1) (A2); 5 Blend Texture (RGB1)(A2); 6 Mix Two Textures (RGB1*0.5+RGB2*0.5) (A1*0.5+A2*0.5)
Operation (iRgbOperation_N, iAlphaOperation_N) 1 Arg0; 2 Arg0*Arg1; 3 Arg0+Arg1; 4 Arg0+Arg1-0.5; 5 Alpha Blend; 6 Arg0*Arg1+Arg2
Blend source (iRgbBlendSource_N, iAlphaBlendSource_N) 1 Texture; 2 Previous; 3 Diffuse; 4 Constant
Arg0 (iRgbArg0_N, iAlphaArg0_N): the fifth item only in the lists named below 1 Texture; 2 Previous; 3 Diffuse; 4 Constant; 5 Texture
Arg1 and Arg2 (iRgbArg1_N, iRgbArg2_N, iAlphaArg1_N, iAlphaArg2_N) 1 Previous; 2 Diffuse; 3 Constant; 4 Texture
Operand (iRgbArg0Operand_N ... iAlphaArg2Operand_N) 1 RGB; 2 Inv RGB; 3 Alpha; 4 Inv Alpha
Texture shader (iTextureShader_N) 1 Disable; 2 TextureOff; 3 FetchTexture; 4 PassThrough; 5 CullFragment; 6 OffsetTexture; 7 OffsetTextureScale; 8 DependentARTexture; 9 DependentGBTexture; 10 DP3; 11 DP3Texture2D; 12 DP3CubeMap; 13 DP3ReflectCubeMap; 14 DP3ConstEyeReflectCubeMap; 15 DP3DiffuseCubeMap; 16 DP3DepthReplace

The script labels blend factors 7 to 10 "Destination Alpha", "Inverse Destination Alpha", "Destination RGB" and "Inverse Destination RGB", but the exporter writes TBlend(value - 1), which for these values is the constant colour and constant alpha factors. The list above carries the names of what the exporter does. The five-item Arg0 list is used only where the notes of the NeL Slot table say so.

Shader types

iShaderType selects the NeL shader. The build maps the value to CMaterial::TShader(value - 1) for 1 to 5, 7 and 8. The value 6 builds a water shape when it is the single material of a node, and a Normal material when it is a sub-material of a Multi/Sub-Object (a water shape refuses sub-materials).

Value Shader Slots built What it uses
1 Normal 1 to 4 The combiner of the four NeL Slot rollouts, the texgen flag of each slot, texture sets, the texture matrix. The only shader for which the "Setup Texture Slots" presets are enabled.
2 Bump ("Not Implemented") 1 to 4 Nothing of its own. NeL has no bump shader; the entry stays in the list as the script has it.
3 UserColor 1 cUserColor. The texture's alpha mixes the user colour in. The mask is not a material property: NeL's texture loader looks for a file named <texture name>_usercolor<extension> beside the texture and merges it into the alpha. The caption of slot 2 only shows that derived name.
4 LightMap 1 iLightMapChannel, bStainedGlassWindow. Always unlit; blending, if on, is forced to Source Alpha and Inverse Source Alpha; the vertex alpha is off. The build gives it the LightMap shader when its lighting option is on (the shape exporter's default; its --no-lighting clears the option) and builds a Normal material otherwise; the editor builds with the option off. Lightmaps are not part of the material: the standalone lightmapper adds them.
5 Specular 1 and 2 Slot 1 is the diffuse map, slot 2 the specular map. Slot 2 is always built as a cube map of six copies of its texture, with reflection texture coordinates. NeL adds the diffuse texture and the product of its alpha with the cube map, in two passes.
6 Water none as a material The water parameters and slots 1 to 7 of the water shape, see below.
7 Per pixel lighting 1 to 4 Needs a UV set for the tangent space. The reference exporter plugin gives the mesh a per-pixel-lighting vertex program with specular, built with a tangent space from the mesh, and gives it to the whole mesh when any sub-material has the shader. The headless exporter builds the material with this shader, leaves the mesh's vertex program empty (a TODO in its source) and only switches the local light attenuation off.
8 Per pixel lighting, no specular 1 to 4 As 7, with a vertex program without specular.

Roles of the texture slots under each shader, as the captions of the "Texture N" check boxes show them:

Shader Captions of slots 1 to 8
Water EnvDay, EnvNight (opt), EnvDayUnder (opt), EnvNightUnder (opt), Bump, Displace, ColorAlpha (opt), Unused
LightMap Diffuse, then Unused
UserColor Diffuse, UsercolorMask, then Unused
Specular Diffuse, SpecularMap, then Unused
any other Texture 1 to Texture 8

At most four slots reach a mesh material (IDRV_MAT_MAXTEXTURES is 4); slots 5 to 8 matter only to the water shape (slots 5, 6 and 7). Under the water shape, slots 1 (EnvDay), 5 (Bump) and 6 (Displace) must be enabled and hold a texmap, or the node gives no shape. In the headless exporter, slots 2, 3 and 4 are used whenever they hold a texmap, whatever their enable flag says, and slot 7 (ColorAlpha) is used when it is enabled and holds a texmap.

When the water shader is selected, the script also unchecks the Unlighted, stained glass, Alpha Test and both Force ZWrite check boxes. Whether that writes the bound parameters was not established; the editor leaves those parameters as they are and disables their controls under the water shader. This is an open point.

Derived flags

iShaderType Flag set to true (all other derived flags false)
1 Normal bNormalShader
2 Bump none
3 UserColor bUserColor
4 LightMap bLightMap
5 Specular bSpecular
6 Water bWater
7 Per pixel lighting bPerPixelLightingShader
8 Per pixel lighting, no specular bPerPixelLightingShader

The headless exporter tests bWater to route a node to the water builder; the reference exporter plugin also tests bLightMap. The script's rollout rules test all six. Only the script's own user interface used to refresh them, so a file written by a tool that sets iShaderType alone can carry stale flags: the editor sets them in one step with the shader type (applyShaderType), and when it reads a sidecar it does not recompute them (it takes the stored values and computes its own enable rules from iShaderType).

The script declares ShaderPerPixelLightingNoSpec with the value 7, the same as ShaderPerPixelLighting, so a material with the value 8 gets no derived flag in the script and its rollouts behave as for the Bump shader. The value 8 is kept as stored, because the exporter reads it as per pixel lighting without specular, and the flag is set as for value 7.

Presets

Alpha buttons

The three buttons set the two blend factors and nothing else (they do not turn bAlphaBlend on). They are enabled under the same rule as the blend factor lists.

Button iBlendSrcFunc iBlendDestFunc
Setup Blend 3 Source Alpha 4 Inverse Source Alpha
Setup Additive 1 One 1 One
Setup Alpha Additive 3 Source Alpha 1 One

Setup Texture Slots

The button applies the preset chosen in the Setup Stage drop-down. A preset first disables all eight texture slots, then enables slot 1 (and slot 2 where the table says so) and assigns only the fields below. Every other field of every slot keeps its value, so a preset does not reset a stage. A preset is one undo step in the editor.

The values are stored values with the item name; "-" means the preset does not assign the field.

Slot 1:

Field (without _N) 1 Single 2 Add 3 Multiply 4 Blend 5 Blend Texture 6 Mix
texture slot enabled enabled enabled enabled enabled enabled
iRgbOperation 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1
iRgbArg0 1 Texture 1 Texture 1 Texture 1 Texture 1 Texture 1 Texture
iRgbArg1 2 Diffuse 2 Diffuse 2 Diffuse 2 Diffuse 2 Diffuse 2 Diffuse
iRgbArg0Operand 1 RGB 1 RGB 1 RGB 1 RGB 1 RGB 1 RGB
iRgbArg1Operand 1 RGB 1 RGB 1 RGB 1 RGB 1 RGB 1 RGB
iAlphaOperation 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1 2 Arg0*Arg1 1 Arg0 2 Arg0*Arg1
iAlphaArg0 1 Texture 1 Texture 1 Texture 1 Texture 1 Texture 1 Texture
iAlphaArg1 2 Diffuse 2 Diffuse 2 Diffuse 2 Diffuse - 2 Diffuse
iAlphaArg0Operand 3 Alpha 3 Alpha 3 Alpha 3 Alpha 3 Alpha 3 Alpha
iAlphaArg1Operand 3 Alpha 3 Alpha 3 Alpha 3 Alpha - 3 Alpha
iTextureShader 1 Disable 1 Disable 1 Disable 1 Disable 1 Disable 1 Disable

Slot 2:

Field (without _N) 1 Single 2 Add 3 Multiply 4 Blend 5 Blend Texture 6 Mix
texture slot disabled enabled enabled enabled enabled enabled
iRgbOperation - 3 Arg0+Arg1 2 Arg0*Arg1 5 Alpha Blend 1 Arg0 5 Alpha Blend
iRgbBlendSource - - - 2 Previous - 4 Constant
iRgbArg0 - 1 Texture 1 Texture 1 Texture 2 Previous 1 Texture
iRgbArg1 - 1 Previous 1 Previous 1 Previous - 1 Previous
iRgbArg0Operand - 1 RGB 1 RGB 1 RGB 1 RGB 1 RGB
iRgbArg1Operand - 1 RGB 1 RGB 1 RGB - -
iAlphaOperation - 2 Arg0*Arg1 2 Arg0*Arg1 1 Arg0 2 Arg0*Arg1 5 Alpha Blend
iAlphaBlendSource - - - - - 4 Constant
iAlphaArg0 - 1 Texture 1 Texture 1 Texture 1 Texture 1 Texture
iAlphaArg1 - 2 Diffuse 2 Diffuse 2 Diffuse 2 Diffuse 1 Previous
iAlphaArg0Operand - 3 Alpha 3 Alpha 3 Alpha 3 Alpha 3 Alpha
iAlphaArg1Operand - 3 Alpha 3 Alpha 3 Alpha 3 Alpha 3 Alpha
iTextureShader - 1 Disable 1 Disable 1 Disable 1 Disable 1 Disable
iConstantAlpha - - - - - 127

The preset 6 values of slot 1 differ from the script (see the next section). A new NeL material starts from the catalogue defaults, the Normal shader with its derived flags, and the preset 1 (Single Texture): slot 1 enabled with Arg0 Texture times Arg1 Diffuse for RGB and alpha.

Differences between the script and the editor

The Material Editor reproduces what the exporters depend on and does not reproduce defects of the script's user interface. These differences are decisions of the implementation that the maintainer may overrule (open point 8 of NeL Material Editor: Design); the first column is what the script does.

Script behaviour Editor
The NeL Slot 4 rollout shows and writes the Arg1 values in its Arg2 drop-downs. Arg2 edits Arg2.
Blend factor labels 7 to 10 name destination alpha and RGB factors but select the constant colour and constant alpha factors. The labels say what the exporter does.
The "Mix Two Textures" preset writes iAlphaArg0_2 where it means slot 1's alpha Arg1. The preset writes the intended field.
ShaderPerPixelLightingNoSpec has the value 7, so value 8 gets no derived flag. The value 8 is kept as stored; the derived flag is set as for 7.
bCalcWaterLightmap is exported nowhere. Shown as in the script, greyed, with the tooltip "not used by the exporter".
The "Not Implemented" (Bump) shader stays in the list. Kept, labelled as in the script.
The glossiness spinner stops at 80 % although the parameter allows 100 %. The range of the control is kept (0 to 80 %).
fWaterHeightFactor is a float with an integer spinner. Kept (0 to 1000 in steps of 1).

Enable rules

The script's rollouts enable controls from the current values. The editor reproduces these rules in enableState, which computes the derived flags from iShaderType itself. In the tables below W, L, U, S, N and P are the Water, LightMap, UserColor, Specular, Normal and Per pixel lighting (7 and 8) shaders.

NeL Material:

Control Enabled when
bUnlighted, the Vertex Program drop-down not W and not L
iLightMapChannel L
bStainedGlassWindow, bColorVertex not W
bAlphaBlend not W and not bAlphaTest
iBlendSrcFunc, iBlendDestFunc, the three alpha buttons not W, not L, bAlphaBlend and not bAlphaTest
bAlphaTest not W and not bAlphaBlend
bForceZWrite not W and bAlphaBlend
bForceNoZWrite not W and not bAlphaBlend
bAlphaVertex not W and not L
iAlphaVertexChannel not W, not L and bAlphaVertex
bump and displace scales and speeds, iWaterPoolID, fWaterHeightFactor, bWaterRealtimeReflection, bWaterEnvMapCalcReflectivity, the fresnel values W and not L
bCalcWaterLightmap never
bWaterUseSceneEnvMapAbove, bWaterUseSceneEnvMapUnder, bEnableWaterSplash, fZBias, cUserColor, bExportTextureMatrix always

The Vertex Program drop-down of the Extended group has no parameter; it offers only "Disable" and nothing reads it (the vertex program is a node property).

NeL Textures:

Control Enabled when
bEnableSlot_1 always
bEnableSlot_2 not L and not P
bEnableSlot_3, bEnableSlot_4 not L, not S, not U and not P
bEnableSlot_5 to bEnableSlot_7 none of L, S, U, N and P
bEnableSlot_8 none of W, L, S, U, N and P
tTexture_1 slot 1 enabled
tTexture_2 slot 2 enabled, not L, not U and not P
tTexture_3, tTexture_4 slot enabled, not L, not S, not U and not P
tTexture_5 to tTexture_8 the slot's check box is enabled and the slot enabled
bTexGen_1 to bTexGen_4 N and the slot enabled (the further terms of the script's rule are always true under N)
bTexGen_5 to bTexGen_8 never (the script's rule contradicts itself)
iShader, the Setup Texture Slots button N

NeL Slot N: every control is enabled when slot N is enabled and the shader is Normal; in addition the blend source needs operation 5 (Alpha Blend) in its channel, and the Arg2 and Oper2 controls need operation 6 (Arg0*Arg1+Arg2) in their channel.

A parameter the material's script version does not have is not editable (a file keeps its script version on save). A parameter that the file drives with an On/Off controller, or with a Linear or Bezier Float controller, is edited as its value at tick 0, with a note (for a float controller, when tick 0 is on a key or outside its keys; see the .max save on NeL Material Editor: Design); a parameter behind another controller is shown read-only with a note (see Export fallbacks).

Texture slot model

A texture slot is the triple bEnableSlot_N, bTexGen_N and tTexture_N. The texmap in tTexture_N is a texture map object of the modelling program, and its fields are what the catalogue calls the texmap fields. In the NeL data of a model (its sidecar, or the extras of a glTF model) the texmap is one JSON object (see NeL-Specific glTF Extras). A slot is built only when it is enabled, holds a texmap, and lies within the number of slots the shader builds.

Texmap kinds

Kind (kind) What it is What the build makes
none No texmap. No texture for the stage.
bitmap A bitmap texmap with one file, file. A CTextureFile named with the file name only, the directory removed. Textures are found at run time through the NeL search paths; the script's own text says the format must be TGA or DDS for in-game use.
multi_bitmap The scripted "Nel Multi Bitmap" texmap: up to eight files, multiFile1 to multiFile8, a texture set each. A CTextureMultiFile sized to the last set file; empty files in between stay empty. The bitmap's own file is the viewport preview only and is not exported.
cube A cube map from six bitmap files (cubeFilePosX, cubeFileNegX, cubeFilePosY, cubeFileNegY, cubeFilePosZ, cubeFileNegZ, in the order of CTextureCube::TFace). A CTextureCube with clamp wrap and linear filtering without mipmaps. The reader of .max files in the exporters does not decode the cube map texmaps of the modelling program yet, so .max materials never arrive as cube; the kind exists in the model and in the sidecar.
unsupported A texmap class the build does not make a texture of (className names it). No texture, a warning, and the stage still gets the texgen flag (it has no UV channel). Shown read-only.

Texture sets (multi bitmap). A multi bitmap is how a material switches its texture at run time. The client calls selectTextureSet(id) on an instance; the id picks the file with that 0-based index. An id past the last file, or a file that is empty, falls back to file 0; a texture with no file at all becomes the dummy texture. The Ryzom client selects the set by season (for the landscape instances and for instance groups) and by quality or variant for items and character parts. The editor's toolbar has a selector for sets 0 to 7 that calls selectTextureSet on every instance.

Specular slot 2. Under the Specular shader the build forces slot 2 into a cube made of six copies of the bitmap (or multi bitmap) with reflection texture coordinates, whatever bTexGen_2 says.

Placement, channel and crop

Field Default Meaning
uOffset, vOffset 0 Offset of the UVs.
uTiling, vTiling 1 Tiling.
uAngle, vAngle, wAngle 0 Rotation about U, V and W, in radians.
wrapU, wrapV true The tiling flags of the texmap. Off gives a clamped texture on that axis; mirror is ignored.
mapChannel 1 (1 to 99) The map channel of the mesh whose UVs the stage uses. Channel 0 is the vertex colour channel.
cropApply, cropU, cropV, cropW, cropH false, 0, 0, 1, 1 The bitmap's crop. When applied, the UVs of the stage are baked as u' = u x W + U and v' = (1 - v) x H + V. The "place" mode of the crop is not read.
name empty The texmap name.

A stage that has bTexGen_N set, and slot 2 under the Specular shader, takes reflection coordinates and uses no UV channel. Stages whose slots use the same map channel share one UV set of the mesh. Under the LightMap shader one more UV set is added that reads the map channel of iLightMapChannel (slot 1's channel when the mesh has none), and it inherits slot 1's crop.

The placement matrix, in the modelling program's convention (row vectors), is scale(uTiling, vTiling, 1) then rotate about X by uAngle, about Y by vAngle, about Z by wAngle, then translate by (uOffset, vOffset, 0). The offset and tiling along W are not read. The NeL texture matrix is C x M x C, where C flips V.

Texture matrix export and animation

  • With bExportTextureMatrix, every enabled slot that holds a texmap and lies within the shader's stage count gets a user texture matrix from its placement matrix (enableUserTexMat, setUserTexMat).
  • The mesh build of the headless exporter writes the UVs of the map channel with the crop applied and without the placement matrix; its source says "identity for now". The reference exporter plugin multiplies the UVs by the placement matrix when bExportTextureMatrix is off, and leaves them untransformed when it is on. How many corpus materials have a non-identity placement with the matrix export off has not been counted. The glTF converter takes its meshes from the same mesh build.
  • The five coordinates uOffset, vOffset, uTiling, vTiling and wAngle of a texmap can carry an animation controller. The animated values of each stage are the runtime tracks UTrans<s>, VTrans<s>, UScale<s>, VScale<s> and WRot<s>, where <s> is the slot index 0 to 3, prefixed with the material name (<material name>.UTrans0; a sub-material uses its own name). Time is in ticks, 4800 per second. The runtime rebuilds the stage matrix from the five values around the pivot (0.5, 0.5).
  • The tracks belong to the node's .anim. They are exported when the node property "Export animated materials" is set, the material has bExportTextureMatrix, and the slot is enabled and holds a texmap; the shape process writes the .anim, and the shape binds it, for a node with "Allow automatic animation".
  • The catalogue holds linear float keys as editable data (interpolation linear, keys in ticks). Bezier controllers and other controller classes are kept as read-only information: the values at the key times, the class name, the tangents not represented. Colour and opacity tracks (ambient, diffuse, specular, emissive, opacity) are not part of the catalogue: the reference exporter plugin reads their controllers from the Standard delegate, and the headless exporter builds the texture matrix tracks only.
  • Two runtime defects in NeL are known: the default tracks of UScale and VScale return the defaults of UTrans and VTrans, and the serial stream of the default texture tracks leaves out the default of WRot. Designed: the animation stage of the editor fixes them in NeL.

Export fallbacks

The headless exporter reads a parameter driven by an On/Off controller, or by a Linear or Bezier Float controller, at its value at tick 0, as the reference exporter plugin reads every controlled parameter. A parameter behind another controller, or missing from the file, takes a fallback. These differ from the defaults for the parameters below; every other parameter's fallback is its default. The editor shows such a parameter read-only, with the fallback as its value.

Parameter Fallback
cAmbient, cSpecular, cUserColor [0, 0, 0]
cDiffuse [255, 255, 255]
pOpacity, pGlossiness 0
iLightMapChannel 0
iShaderType 0 (builds with a warning as Normal)
every other i... value of the NeL Slot blocks 0
cConstant_N [255, 255, 255]
iConstantAlpha_N 255

Script versions 14 and 15

The script keeps its parameters in parameter blocks and a .max file stores them by position: the parameter id is the index among the parameters of the block, in declaration order, for the script version the material was saved with. The version stamp is a chunk of the material (two integers: the script version and the number of parameter blocks). The script's developer note requires a new major version for every change of the parameter structure and a backup of the old script file; the kept backups are nel_material.ms.v1, .v2, .v3, .v5, .v11 and .v14 next to nel_material.ms.

Version 15 (water reflection, July 2026) inserted five parameters in the middle of the main block, after bEnableWaterSplash and before bColorVertex: bWaterRealtimeReflection, bWaterEnvMapCalcReflectivity, fWaterFresnelBias, fWaterFresnelScale and fWaterFresnelPower. Every main id from bColorVertex on is therefore 5 higher in a version 15 material than in a version 14 one. No other block changed: nlbp has 10 parameters, textures 24 and each slot block 19 in both versions. There is no version 16 yet; a planned one is described on Water Volume Color.

Parameter v14 id v15 id
bLightMap 0 0
bUnlighted 1 1
bStainedGlassWindow 2 2
bAlphaTest 3 3
bForceZWrite 4 4
bForceNoZWrite 5 5
bWater 6 6
bWaterUseSceneEnvMapAbove 7 7
bWaterUseSceneEnvMapUnder 8 8
fBumpUScale 9 9
fBumpVScale 10 10
fBumpUSpeed 11 11
fBumpVSpeed 12 12
fDisplaceMapUScale 13 13
fDisplaceMapVScale 14 14
fDisplaceMapUSpeed 15 15
fDisplaceMapVSpeed 16 16
fWaterHeightFactor 17 17
iWaterPoolID 18 18
bCalcWaterLightmap 19 19
bEnableWaterSplash 20 20
bWaterRealtimeReflection - 21
bWaterEnvMapCalcReflectivity - 22
fWaterFresnelBias - 23
fWaterFresnelScale - 24
fWaterFresnelPower - 25
bColorVertex 21 26
bAlphaVertex 22 27
iAlphaVertexChannel 23 28
bAlphaBlend 24 29
iBlendSrcFunc 25 30
iBlendDestFunc 26 31
iShader 27 32
fZBias 28 33
iLightMapChannel 29 34
iShaderType 30 35
bUserColor 31 36
bSpecular 32 37
bNormalShader 33 38
bPerPixelLightingShader 34 39
cUserColor 35 40
bExportTextureMatrix 36 41

How the tools handle it:

  • The catalogue gives every parameter its Since. The id of a parameter for a version is computed from the catalogue (scriptParamId): the position among the parameters of its block that have Since not above the version. The tables of versions 14 and 15 are therefore not two lists but one list and a rule, and a test compares both against the script text and the version 14 backup.
  • The catalogue is checked against the scripts by unit tests. EveryScriptParameterOnceWithTypeAndDefault reads the text of nel_material.ms: every parameter it declares (152 in version 15) appears once in the catalogue with the same block, type, declared default and declaration order. Version14IdsFollowTheV14Script does the same with nel_material.ms.v14 (147 parameters) for the version 14 ids.
  • Materials of script version 14 and 15 are read, in the exporters and in the editor. A NeL Material of an older version is not decoded; the headless exporter builds it as the Standard material it holds, and the editor shows it read-only with that reason. The whole graphics corpus of the project is version 14.
  • A file keeps its material's script version on save. The parameters of version 15 are editable only in version 15 materials. A new material is version 15.
  • The script version is the version key of the nel_material_script object, in the sidecar entry or in the extras of a material of a glTF model, 14 or 15. For a version 14 material the object still lists every catalogue parameter; the five version 15 parameters carry their defaults and are not editable.
  • The exporters read the parameters by these ids. The editor's .max writer finds each parameter by its name in the definition of the script that the file stores in its configuration stream (the stream lists every block and parameter name in order for the scripted class), and checks that this definition gives the blocks and the ids the catalogue gives for the material's script version: a material whose stored definition disagrees is not edited, and the reason says where.

See also

⚠️ **GitHub.com Fallback** ⚠️