Random Color Texture, per Element

3D Studio Max Plugin (Export Script Plugins developed by [gk] and KilaD; Integrated Plugin developed by Karba)
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
User avatar
mbetke
Licensed Customer
Posts: 1293
Joined: Fri Jun 04, 2010 9:12 am
Location: Germany
Contact:

Is it possible to randomly tint an element and not the whole object? At the moment I have to detach all elements to tint it randomly.
PURE3D Visualisierungen
Sys: Intel Core i9-12900K, 128GB RAM, 2x 4090 RTX, Windows 11 Pro x64, 3ds Max 2024.2
HHbomb
Licensed Customer
Posts: 1370
Joined: Wed Jun 30, 2010 8:45 pm
Contact:

You can use "Material by element" modifier. But you need to make a multimaterial with lot of ID.
You can user a data channel modifier to assign a random vertex color for each element.

+1000 if otoy can make a random color by element !!!!! :-)
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |
User avatar
mbetke
Licensed Customer
Posts: 1293
Joined: Fri Jun 04, 2010 9:12 am
Location: Germany
Contact:

Yes, because that's why I ask. :)
I think Corona/Vray supports it. Sometimes the small things are the handy ones.
PURE3D Visualisierungen
Sys: Intel Core i9-12900K, 128GB RAM, 2x 4090 RTX, Windows 11 Pro x64, 3ds Max 2024.2
Pavlov
Licensed Customer
Posts: 158
Joined: Fri May 21, 2010 8:49 am

+ 100 on this.

In Corna and Vray we use this all of the time, it's priceless - you can differentiate leaves, buildings etc, without the need of assigning multiple materials.

Paoo
I7 960 3.2 GHZ - 6GB ram - GTS 250 display only - Asus GTX 470
User avatar
paride4331
Octane Guru
Posts: 3804
Joined: Fri Sep 18, 2015 7:19 am

2 x Evga Titan X Hybrid / 3 x Evga RTX 2070 super Hybrid
Pavlov
Licensed Customer
Posts: 158
Joined: Fri May 21, 2010 8:49 am

Hi Paride,

hard to tell since these are MAX examples but i'll try to explain.

Imagine a city made of many boxes, all part of the same mesh. I want to assign a different texture to each box (different facades) without having to assign, say, 20 random IDs. In Corona and Vray, the Randomizer can work not only on instances (like Octane Randomizer does) but also on individual elements of a single mesh. This means I can randomize 20 textures on each element of that single mesh without assigning different IDs or creating multiple materials—it's just one object with one material using a "Randomizer by Element" that randomly applies one of 20 textures to each box.

This approach is also very useful in many other situations, such as with trees. For example, you can assign 5 different leaf textures to each leaf (element) using a single material on a single mesh.

Hopefully it's clear, let me know if i've to explain better.

Thanks
Paolo
I7 960 3.2 GHZ - 6GB ram - GTS 250 display only - Asus GTX 470
Pavlov
Licensed Customer
Posts: 158
Joined: Fri May 21, 2010 8:49 am

PS - some time ago i raised same topic - randomize by element - and someone posted a OSL that could do that.
I wanted to give it another run, but i cannot find it.

Can someone point me to the link ?

thanks
paolo
I7 960 3.2 GHZ - 6GB ram - GTS 250 display only - Asus GTX 470
Pavlov
Licensed Customer
Posts: 158
Joined: Fri May 21, 2010 8:49 am

Just for clarity, this is same thing in Lightwave - single mesh, but different colors (or maps) for each leaf using an element-aware randmizer.

best
Paolo
Attachments
Mesh_aware_Random_node.jpg
I7 960 3.2 GHZ - 6GB ram - GTS 250 display only - Asus GTX 470
HHbomb
Licensed Customer
Posts: 1370
Joined: Wed Jun 30, 2010 8:45 pm
Contact:

+10000
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |
neonZorglub
OctaneRender Team
Posts: 1002
Joined: Sun Jul 31, 2016 10:08 pm

Here is a new OSL texture that select random texture per element.
random_tex_per_element.png
random tex per element.zip
(348.92 KiB) Downloaded 11 times
The objects need to have an Octane geometry modifier, with a Vertex Attributes Generator set as follow:
Generator: PolyConnect
Attribute: Float1
Attribute name: ElementId

The OSL texture rand10Tex_ByElem_obj_uid.osl need to have a Grayscale vertex attribute in the 'Grayscale tex' input.
The Grayscale vertex attribute need to use the same attribute Name as in the geometry modifier : ElementId

Set the Texture count between 1 to 10.

When using multiple instances or copies of the same object, the vertex attribute values will be the same, so the random pattern will also be the same for each instance.
To have random variation on those instances, enable the 'Use Object seed' and / or 'Use InstanceID seed'

'Use Object seed' add randomness from an internal unique ID per object, but those IDs could change as you add/remove objects in the scene.
'Use InstanceID seed' add randomness from the 'User instance ID' that can be set per object in the Octane Object properties dialog.
Those Instance IDs will not change, so the random pattern will be more stable.
Note that you can use the tools in the Octane Object properties dialog to set those User instance IDs for all selected objects.
setting_user_instance_IDs.png
The second OSL (rand20Tex_ByElem_obj_uid.osl) is the same, but with up to 20 textures.

for 3dsMax 2018:
random tex per element_mx18.zip
(346.54 KiB) Downloaded 12 times
Post Reply

Return to “Autodesk 3Ds Max”