Jump to content

Dear Visitors

If your confirmation email doesn't arrive, give us some time while we manually approve your account. Support ticket is not necessary, we are checking new registrations regularly and approving if registration requirements are met.

Please read Rules & Guidelines before posting around Forums. Information we seek is minimal and in the end saves us a lot of time and we are able to provide solutions faster.

Please consider supporting us via Contributions for all the work we are doing. Contributing even with the smallest amount, will remove ALL AD's and unlock some nice features like being able to be Tipped for providing help, or file etc.


Cinema 4D Scripting - How to randomize rendering between multiple objects


puccks

Recommended Posts

Hello, 

 

Basically I want to randomize the renders somehow. 

Let's say I have 10 human bodies modeled, 10 haircuts, 10 types of shirts and so on. I want to render out different random combinations of these objects, without doing it manually. 

 

Do you have any idea how can I do that ? 

 

Thanks! 

Link to comment

Depends on whether you want to have a specific solution for your current setup, or a generalized solution.

 

If your variants are located in a null each (e.g. one null with haircut1, haircut2, haircut3 etc, another null with shirt1, shirt2,...), then you would just go through all these nulls (search by name), select one child randomly (count children, determine one random number in that interval), set this child to visible and all others to invisible. Once you have treated all your options that way, so each of these nulls only has one visible child (one option), you'd simply start a render. You could let the script run overnight to render out a few dozen variants.

 

Your issues will be:

 

1. depending on the number of variants, a combination may repeat. If you want to prevent that, you'd need to save the already-done combinations in a list and compare on each new attempt whether your current combination is already in that list (in that case, skip and don't render).

 

2. The script will need to terminate before you can continue working in C4D, at least in the "simple" solution where you just trigger the render directly. If you have an endless loop in the script, or you want to terminate the script prematurely, you will need to kill the C4D process on the machine. You can program a more sophisticated solution with a dialog and an interrupt mechanism, and start the render on another thread, but that is significantly more work.

 

 

----------
Learn more about Python for C4D scripting:
https://www.patreon.com/cairyn

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • LATEST ACTIVITIES

    1. 25

      Whistle for Me - Short horror animation

    2. 3

      Tried everything to get this environment without luck. Can you help?!

    3. 53

      Houdini 19 - 11min Sneak Peek

    4. 3

      Tried everything to get this environment without luck. Can you help?!

    5. 0

      Sweep to PLA

×
×
  • Create New...

Copyright Core 4D © 2021 Powered by Invision Community