Create random textures over instances

Forum for OctaneRender Lua scripting examples, discussion and support.
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

(This is an updated version of abstrax' script, it works in Octane 3.00 alpha 10, and Octane 2.25.)

Download here (updated on 23 May)
Texture Scatter.lua
(26.24 KiB) Downloaded 1398 times
This script creates a number of random image textures, and allows you to use one of these (at random) on each instance of a mesh. It is possible to vary the input image file, and the image transform for each image texture.
Settings
Settings
Small example with 10 variations
Small example with 10 variations
How to use:
  • The first time you run the script, pick your settings and create a new node graph.
  • To update a node graph you created earlier, select the node graph and then run the script.
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Roeland,

Thank you so much for fixing the script.

There are some very important features that the script lacks of: selection of a single texture (not a catalogue) and lock for proportions scaling. Plus vertical and horizontal flip (negative scaling) - attached.

Random texture node that would work in real time is so needed. Namely it could work like this: when you connect it to the texture input it would come with a single input for a texture but with the option to increase number of inputs - exactly the same way that the geometry group works. And another random 3d transform having all parameters from LUA would be great. The schematic is attached.
Attachments
Random-Texture2.jpg
Random-Texture.jpg
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

OK I added those two improvements.

You can now lock the aspect ratio of the settings in the scale group, and you can also mirror the textures at random.

If you want to mirror all instances, set the scale of one of the scaling channels to negative values.

--
Roeland

(ps. that will be it for a while, I'll leave further enhancements up to you)
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Roeland,

So many thanks!

Selecting images instead of folder works like a charm - great! Mirror options work great, but:

1. The most important feature - lock aspect ratio - is not well coded. Sorry, this is my fault - I should give you more explanation. So here it is: it is not about having same values in the input LUA panel, but the same values in the final UV transform for S.X and S.Y. - see the screenshot. So please add aspect ratio option to the input panel, and if a user chooses aspect ratio as 1 we shall see same values in the final UV transform for S.X and S.Y (with +- signs when the mirror is used). So the code for final S.Y may look like S.Y = c*S.X, where c is aspect ratio.

2. A bug: when I open any group in the node graph and run the script the final node occurs in the scene tab, not in the tab where I am currently in. It works only for updating the script. What I have to do is go to the scene tab, cut the node and paste it into a desired tab.

You are the man! It's almost done ;)
Attachments
Random-Texture4.jpg
Random-Texture3.jpg
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Any response, please...
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Guys,
Just a simple fix and this will be great. Please, please, please...
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

OK I should have though that one through I guess.

Update in original post

--
Roeland
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

What a beautiful day :D

Thank you so so so so so much!
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
franchus
Licensed Customer
Posts: 44
Joined: Fri May 13, 2016 7:57 am
Location: Barcelona
Contact:

Woooow! you just saved my life, I could not do this with c4d cloned instances and now it's like magic. I just loaded the script applied it to a material and saved the material in local DB, then imported the material in C4d and voilá! I'm saved by your wits!

thumbs up!
cheers!
frankie3333
Attachments
the texture applied to mograph clones that clone instances.
the texture applied to mograph clones that clone instances.
User avatar
smicha
Licensed Customer
Posts: 3151
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Great. The script is very powerful and has potential for further development ;)
3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
Post Reply

Return to “Lua Scripting”