Itoo Software Forum

Author Topic: Material Randomize per ID  (Read 999 times)

Guillermo Leal

  • Newbie
  • *
  • Posts: 20
Material Randomize per ID
« on: July 20, 2015, 04:34:16 PM »
Paul,

let me see if i can explain my self.

I have an object (brick) with 2 materials. the brick its self that uses the mutlitexture plugin to randomize the textures and the mortar joints, the problem is that if i add a material operator to randomize the material id's it also randomized the mortar id's, is there a way to to limit the range for example id 1 (the mortar) is not affects then for the brick to randomize from 2 to 100. is there a why to do that?

Guillermo Leal.

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1539
Re: Material Randomize per ID
« Reply #1 on: July 20, 2015, 05:14:47 PM »
Hi Guillermo,

This is a little tricky with Multi-Texture but not impossible. The problem is that the multi-sub material loops through the IDs when they're out of range on the source geometry. So for example with a multi-sub where ID1 = grout and ID2 = brick textures(with multitexture map), if the face id is 3,5,7,8 ... you will get the grout texture instead of the brick texture.

The solution therefore is to make sure that the multi-sub texture's number of IDs is the same as the randomisation range of the material operator. So imagine you have 9 brick textures. You would need to create a Mult-Sub material with the Grout in ID1 and the Bricks material instanced into ID slots 2-10.



You can then set the Material operator up to randomise within that range:



You might also be interested to know that VizPark's Crossmap plugin does not suffer from this limitation as it can randomise by V-Ray instances, so doesn't need randomised IDs. In my tests, it worked well for situations like this.

I hope that helps, please let me know if there's anything else I can do.

Many thanks,

Paul
« Last Edit: July 20, 2015, 05:36:25 PM by Paul Roberts »
Paul Roberts
iToo Software

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1539
Re: Material Randomize per ID
« Reply #2 on: July 20, 2015, 05:27:45 PM »
It's just occurred to me that actually the Multi Texture map assigns textures randomly to the IDs, so if you have exactly the same number of face IDs as maps you're likely to end up with repetition of the texture within the range. It's easy to fix though - you'd just need to instance the brick material into additional ID slots on the Mult-Sub material and adjust the RC object's material operator accordingly.

Alternatively you could just use a V-Ray bitmap loader instead of a Multi Texture:



Hope that helps.

Cheers,

Paul
Paul Roberts
iToo Software

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 1539
Re: Material Randomize per ID
« Reply #3 on: July 20, 2015, 08:59:57 PM »
I realise it might be a bit tedious to instance the multi-texture material into a large number of mult-sub slots so here's a little script to automate it.

Multi-Sub Instancer


This will instance the Material in the ID slot specified in ID of Mat to Copy to the IDs between the range defined by ID Range Start and ID Range End. Just set the values, make sure the multi-sub material is the active slot in the material editor and hit Instance to ID Slots

Be careful though, the script will overwrite any existing materials in the specified ID range, and once you've run the script you can't undo.

Hope it helps someone.

Cheers!

Paul
Paul Roberts
iToo Software

Guillermo Leal

  • Newbie
  • *
  • Posts: 20
Re: Material Randomize per ID
« Reply #4 on: July 20, 2015, 10:59:02 PM »
thanks Paul,

wow a 180 multisub material !, but it works. i have never use the crossmap i will take a look.

as always amazing support, thanks again.

Guillermo Leal.