Random texture offset (but cloner in cloner)

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

Post Reply
wriedl
Licensed Customer
Posts: 2
Joined: Fri Dec 14, 2018 1:19 pm

Hi,
I am unable to solve the problem I am currently stuck in:
I found great advice on how to randomize texture offset with the OSL shader method and

Code: Select all

color variance = noise("cell",rndm, Seed);
c = noise("cell",_getinstanceid(),Seed);
This works really great, but I have a cloner within a cloner.
So the instance IDs the low-level cloner generates simply get repeated in each of the high-level cloner instances.

Do you have a hint for me on how I can get unique instance IDs?
Alternatively, I would love to use an instance-independent random number, but cannot find a way to generate one in OSL.

Thanks in advance
Wolfgang
User avatar
jobigoud
OctaneRender Team
Posts: 247
Joined: Sat Aug 15, 2015 1:28 pm

For random numbers uncorrelated between neighbor instance ids you can use "Hash" noise instead. Something like this:

Code: Select all

float c = noise("hash", _getinstanceid());
To simulate a seed you can multiply the instance id by a number.

Note that you can also do this without OSL using the "Instance range" and "Random map" nodes.
RSgraphics
Licensed Customer
Posts: 143
Joined: Wed Aug 03, 2016 4:04 pm

I hope Otoy makes a solution for people that dont know how to write code
User avatar
aoktar
Octane Plugin Developer
Posts: 16063
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

Another try to do something similar
Attachments
1.rar
(159.1 KiB) Downloaded 147 times
a3.jpg
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
wriedl
Licensed Customer
Posts: 2
Joined: Fri Dec 14, 2018 1:19 pm

Thanks for the input, I appreciate the time you invested!
But still, my problem remains the same. When I have a cloner inside a cloner, the objids and instance IDs remain the same and get cloned.
So unless I am missing something, both of your solutions still produce a dimension of repetition.
In my case, I clone parts of a house vertically and then clone those parts horizontally. Those horizontal parts are then repeating the "random" offsets I created in the first-level vertical dimension.
User avatar
aoktar
Octane Plugin Developer
Posts: 16063
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

What are you using? Render instances?
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
User avatar
jobigoud
OctaneRender Team
Posts: 247
Joined: Sat Aug 15, 2015 1:28 pm

RSgraphics wrote:I hope Otoy makes a solution for people that dont know how to write code
As I wrote you can do uncorrelated random numbers without code, using Instance range and Random map on hash noise, in standalone it would look like this:
instance-random-number.png
To randomize UVs with this you can send it into the "Distorted mesh UV" projection.
instance-uv-translation.png
wriedl wrote: In my case, I clone parts of a house vertically and then clone those parts horizontally. Those horizontal parts are then repeating the "random" offsets I created in the first-level vertical dimension.
Could you use a 2D grid directly instead of nested 1D arrays ? Then each part will have its own ID.
Post Reply

Return to “Maxon Cinema 4D”