Random shifting of texture UV coordinates?

Forums: Random shifting of texture UV coordinates?
Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderator: aoktar

Random shifting of texture UV coordinates?

Postby pcoombes » Tue Feb 26, 2019 3:31 am

pcoombes Tue Feb 26, 2019 3:31 am
Sorry if this is basic, but I'm trying to randomly assign/shift the UV coordinates of a single wood material on approx. 125 separate planks/panels in a wall so that there are no repeating patterns. This is an imported model, so I can't use an Octane Scatter object or a MoGraph object (I've tried a Fracture object, but I couldn't get a result).
Can someone point me in the right direction?
pcoombes
Licensed Customer
Licensed Customer
 
Posts: 5
Joined: Thu Dec 04, 2014 4:19 am

Re: Random shifting of texture UV coordinates?

Postby aoktar » Tue Feb 26, 2019 8:04 am

aoktar Tue Feb 26, 2019 8:04 am
Osl is the right way to look.
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
User avatar
aoktar
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 12685
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye

Re: Random shifting of texture UV coordinates?

Postby milanm » Tue Feb 26, 2019 9:14 am

milanm Tue Feb 26, 2019 9:14 am
Hi pcoombes

Well, for some reason builtin RandomColor node is not "seeing" the instanceID numbers in a Fracture setup but OSL does.
Instance Range works too.

This great script from Beppe should do exactly what you need.
https://render.otoy.com/forum/viewtopic.php?f=73&t=69211

You can use this instead of RandomColor node. It will work with Fracture + Explode segments. Or, for example, as an input in Gradient node (complex mode) to randomize (multi)textures.

Code: Select all
#include <octane-oslintrin.h>
shader RandomInstanceColor(
      int Seed=0,
      output color c = 0)
{   
      c = noise("cell",_getinstanceid(),Seed);
}


With this one you can mask individual objects based on ID. You will see that InstanceIDs mach Index numbers exactly.
InstanceIDs.PNG


Code: Select all
#include <octane-oslintrin.h>
shader InstanceID(
      color A = 1, color B = 0,
      int InstanceID = 0 [[int min=0, int slidermax=100]],
      int Swap = 0 [[string widget = "checkBox"]],
      output color c = 0)
{
   color outA = A;
   color outB = B;
   
   if (Swap==1) { outA = B; outB = A; }
   c = (InstanceID==_getinstanceid())? outA: outB;
}


Cheers
Milan
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
milanm
Licensed Customer
Licensed Customer
 
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

Re: Random shifting of texture UV coordinates?

Postby pcoombes » Thu Feb 28, 2019 2:48 am

pcoombes Thu Feb 28, 2019 2:48 am
Thanks, Milan, that's exactly what I needed.
And thanks Beppe!
It's a shame one has to resort to scripting to get something fairly common to work.

Cheers
pcoombes
Licensed Customer
Licensed Customer
 
Posts: 5
Joined: Thu Dec 04, 2014 4:19 am

Re: Random shifting of texture UV coordinates?

Postby bepeg4d » Sun Mar 03, 2019 9:51 am

bepeg4d Sun Mar 03, 2019 9:51 am
Big thanks Milan for sharing the RandomInstanceColor.osl node :D
I have updated my post here with .orbx and .c4d example files.
Happy GPU Rendering,
ciao Beppe
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 6741
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Return to Maxon Cinema 4D


Who is online

Users browsing this forum: No registered users and 7 guests

Sat Dec 07, 2019 9:56 pm [ UTC ]