On 22/02/2018 at 01:23, xxxxxxxx wrote:
Hey Everyone,
Ive created a python tag that takes a master shader and a list of displacers as its input.
I would like to take the noise shader and instance it X amount of times, copying all of the data but changing the seed for each instance. Then feed this into each displacer object (so essentially i have exact same noise, just with a different seed).
This is the code i have so far:
_def main() :
# GET USER DATA
tex = op[c4d.ID_USERDATA,1]
displacer = op[c4d.ID_USERDATA,2]
# GET NOISE SHADER IN LUMINANCE CHANNEL
shader = tex[c4d.MATERIAL_LUMINANCE_SHADER]
# GET CLONE OF SHADER AND CHANGE SEED
shader_2 = shader.GetClone()
shader_2[SLA_NOISE_SEED] = 1024
# ADD CLONED SHADER INTO THE DISPLACER SLOT
displacer[c4d.ID_MG_SHADER_SHADER] = shader_2
_
The cloned shader wont load into the displacer slot when i try to run this code...
However when i set the seed to different values for both and print them out, they seem to have worked
So my question is, is what i am trying to do even possible (instancing a shader in one material)? Or do i need to store the cloned shader into a new material, am i not copying the data correctly etc etc
Any help or clues much appreciated!
Thanks,
Cerac
__