A new texture, TexRandomizer is available from version 2025.1 16.04.
It is designed to assign textures randomly per elements of a single mesh.
To differentiate those elements, it assign an Octane Geometry modifier set to generate vertex attributes with the PolyConnect generator.
(This is done semi-automatically, with the Reference Objects rollout)
It can use up to 20 textures or colors, with each an Occurrence parameter to set an individual probability per texture.
Those colors can be shifted and multiplied, and then mixed with a Base color / texture.
TexRandomizer can be found in Maps/Octane/Wrappers/
----------- Main rollout 'Texture list' : -------------
Attribute name:
The vertex attribute name that will be used as part of the randomization.
Keep the default 'ElementId' to use the PolyConnect generator.
Other vertex attribute could be used for other effects, as long as they exist in the mesh.
Texture count:
Valid values: 1 to 20:
Note that there are two internal OSL shaders, one for up to 10 textures, and one for up to 20 textures.
Using more than 10 textures might reduce the performances a little.
Base seed.
The seed of the random generator.
Change this value to generate a different random texture selection.
Use Object seed.
When the TexRandomizer is applied to several objects (copies or instances), the same vertex attributes and same Base seed will result in the same random texture selection.
To have different random effect for those same objects, enable the 'Use Object seed' option.
Each object of the scene has an internal unique ID that will be added to the seed.
Use Instance ID.
Use the User instance ID as part of the random seed.
This is only useful if Use Object seed is disabled, and you want different random effect per object.
The User Instance ID can be set per instance in Octane Object Properties dialog.
Note that the Octane Object Properties has tools to set those IDs for all selected objects (see the first '...' button).
Base color.
A texture or color that will be mixed with the selected random color.
mix
A value, or texture that will indicate how the Base color will be mixed with the random color.
A noise texture can typically be used to randomly mix the base texture based on spacial position.
Random offet, Random Mult, Random add:
Can be used to offset and amplify the selected random color, before being mixed with the base color.
The OSL code is something like this:
color baseRnd = ((random_color + randOffset) * randMult) + randAdd;
c = (baseColor * k) + (baseRnd * (1 - k));
Random colors / textures:
There are 2 extra parameters for each texture:
-Mix power : a value between 0 and 1, to indicate how much this texture will be mixed with the Base color
-Occurrence : a positive value, representing a probability to get selected.
Each Occurrence value is normalized in the range (0, total of occurrence values).
For example, if Texture count is set to 3, and the 3 occurrences are 10,20,100, the actual probabilities are 10/130 (7.69%), 20/130 (15.38%) and 100/130 (76.92 %)
----------------- Reference Objects rollout ----------
This allow to setup the vertex attribute generator correctly for each objects using this texture.
Note that this list is not actively updated when new objects are created and assigned to this texture.
Use the Refresh objects to get an updated list.
As the basic purpose of the TexRandomizer is to assign textures based on the mesh 'element', this list shows attributes as 'valid' only if the objects have an Octane Geometry modifier, and when this modifier's Vertex attribute generator is set to PolyConnect with the expected name (ElementId) and type (Float1).
The "Fix issues" button will be displayed if some objects are not set as expected.
Press it to setup PolyConnect and ElementId.
Note that the tooltip on the "Fix issues" button is currently incorrect: "Setup Octane Geometry Modifier for Multi Texture usage."
It should be "Setup Octane Geometry Modifier for TexRandomizer usage : PolyConnect and ElementId"
But you may use TexRandomizer without geometry modifier or vertex attributes, or use it with another attribute like MaterialId..
In those cases, you can safely ignore the red 'invalid attribute' message and the "Fix issues" button ..
You can use the context menu (right click) on the objects to see options to set the attributes automatically.
--------
Known issues:
-When using the Slate Material Editor, the texture names shown in the connection window are incorrect.
{TxSel1 to 5 correspond to BaseColor, mix, etc.., and TxSel6,7,.. correspond to random texture 1,2,..)
-When switching between 2 TexRandomizer textures in Material editor, some parameters are not correctly updated. Work around: edit another type of texture/material, then switch to the second TexRandomizer.
-When exporting to ORBX, if 'ABC' export is not enabled, the vertex attributes won't be exported.
------------
Basic setup steps:
Create a teapot.
Create a Diffuse material in Material Editor.
Set the Diffuse parameter type as a Texture.
Create a TexRandomizer in the Diffuse texture.
Set Texture count to 4
Set the 4 colors as red, green, blue, yellow
Assign the material to the teapot.
Press the Refresh objects button.
Press the 'Fix issues' button.
Open Octane viewport
Change the Base seed to view different random selections.
(see TexRandomizer00_teapot_basic_mx20.max in the samples)
------------ Samples: ---------
TexRandomizer01_tree03_basic_mx20.max
The default setting of a TexRandomizer.
TexRandomizer02_tree03_BaseTxNoise_mx20.max
The Base color is set as a Multiply texture with a Red color and a Cinema 4D noise,
TexRandomizer03_tree03_BaseTxNoise_darkenRndCol_mx20.max
The random colors are adjusted with Random Mult and Random Add
TexRandomizer04_tree03_BaseTxNoise+noisedMix_mx20.max
The mix texture is set as a Fractal noise, to add variation from spacial element location.
TexRandomizer05_tree03_mixC4D_mx20.max
2 TexRandomizer with green and red tints are mixed with a Cinema 4D noise, to create green and red areas.
TexRandomizer06_objects_objSeed_mx20.max
Usual objects can be used without Octane geometry modifier / without vertex attributes
TexRandomizer07_objects_elementIDs_mx20.max
ElementId / Poly connect can be added to objects that have multiple elements (teapots).
(Similar to tutorial TexRandomizer00_teapot_basic_mx20.max)
TexRandomizer08_objects_MtlIdx_mx20.max
mesh faces can be differentiated with their Material IDs, using the Material Index generator.
This setup vertex attributes based on the material IDs.
Note that the attribute name is left as 'ElementId'. This works fine, as long as both the attribute generator and the TexRandomizer use the same name.
It could be changed to MaterialIndex for clarity...
TexRandomizer09_textures_mx20.max
Textures can be used instead of colors.
-----------------------------
Note: A set of gradient tools can be found in the context menu (right click) of each random texture type.
This allows to create colors from first to current, current to last, and a 'start' to current. The 'start' one can be set with the 'Set color gradient Start as ##' option
TexRandomizer : Random color texture, per Element
Forum rules
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
- neonZorglub
- Posts: 1002
- Joined: Sun Jul 31, 2016 10:08 pm
Here are the same samples for 3dsMax 2017 and higher:
Thanks ! Need to be studied seriously 
I didn't see the gradient tool ! Nice !

I didn't see the gradient tool ! Nice !
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |