Create random textures over instances

Forums: Create random textures over instances
Forum for OctaneRender Lua scripting examples, discussion and support.

Create random textures over instances

Postby roeland » Wed May 04, 2016 1:28 am

roeland Wed May 04, 2016 1:28 am
(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 592 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.

scatter UI.png
Settings


scatter example.png
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
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: Create random textures over instances

Postby smicha » Thu May 05, 2016 6:33 am

smicha Thu May 05, 2016 6:33 am
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
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Create random textures over instances

Postby roeland » Fri May 06, 2016 12:51 am

roeland Fri May 06, 2016 12:51 am
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
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: Create random textures over instances

Postby smicha » Fri May 06, 2016 7:41 am

smicha Fri May 06, 2016 7:41 am
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
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Create random textures over instances

Postby smicha » Tue May 10, 2016 9:46 am

smicha Tue May 10, 2016 9:46 am
Any response, please...
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Create random textures over instances

Postby smicha » Wed May 18, 2016 8:41 pm

smicha Wed May 18, 2016 8:41 pm
Guys,
Just a simple fix and this will be great. Please, please, please...
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Create random textures over instances

Postby roeland » Sun May 22, 2016 10:49 pm

roeland Sun May 22, 2016 10:49 pm
OK I should have though that one through I guess.

Update in original post

--
Roeland
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1741
Joined: Wed Mar 09, 2011 10:09 pm

Re: Create random textures over instances

Postby smicha » Mon May 23, 2016 6:45 am

smicha Mon May 23, 2016 6:45 am
What a beautiful day :D

Thank you so so so so so much!
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland

Re: Create random textures over instances

Postby franchus » Tue May 24, 2016 3:25 pm

franchus Tue May 24, 2016 3:25 pm
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
Screen Shot 2016-05-24 at 17.24.03.png
the texture applied to mograph clones that clone instances.
franchus
Licensed Customer
Licensed Customer
 
Posts: 38
Joined: Fri May 13, 2016 7:57 am
Location: Barcelona

Re: Create random textures over instances

Postby smicha » Tue May 24, 2016 6:11 pm

smicha Tue May 24, 2016 6:11 pm
Great. The script is very powerful and has potential for further development ;)
Win7, Modo 10.1, Octane for Modo and Sketchup, nVidia latest, TITAN+3x780 6GB, 2600K, P8P67WS, 32GB, 1350W
SMH10, EK, Airplex_480, SR1_560, 20xNB_PL2, 2xD5, Aquaero 6XT
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
User avatar
smicha
Licensed Customer
Licensed Customer
 
Posts: 3145
Joined: Wed Sep 21, 2011 4:13 pm
Location: Warsaw, Poland
Next

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 0 guests

Wed Nov 13, 2019 1:00 pm [ UTC ]