Jump to content

If-Node in node network


Yalf

Recommended Posts

Hello,

I was wondering if there is a way to to randomize which way Houdini "walks" in a node network?
In the attached picture you can see what I try to accomplish.

The python node code:

import random

randomNr = random.randint(0, 1)
print randomNr

I want to use this random number to either go to the antenna node and create an antenna for the house OR go to the satellite node and create a satellite on the house.


Is this possible in Houdini?
Thanks in advance for the help!

Houdini If-Node.PNG

Link to comment
Share on other sites

It is, but not most common way to do things. Imagine instead of two things you want to randomize 10, now you have a monstrous network.

You can use the Switch SOP and use either python or hscript to randomize the input. As you might imagine, the more inputs you have, the harder this becomes. Example file below.

Usually what people do in situations like yours is save the set dressing to disk and just randomizing the loading path. People usually avoid the fully dynamic approach because it's common for fully randomized pieces to simply not fit together well.

If you want the fully dynamic approach you might want to create different assets from your attachable geometry. Another approach that might lead to better organization is to use a Object Merge SOP and randomize just the path to the output of whatever network is generating the set dressing.

 

 

randomize_network_path_odf.hip

Link to comment
Share on other sites

I'm not sure I understand the example.
How can the python node influence the switch node above it? And is the python node supposed to send an int to the switch node? If so, how do I send a variable from the python node to the switch node?
 

On 10/7/2019 at 3:45 PM, vtrvtr said:

Usually what people do in situations like yours is save the set dressing to disk and just randomizing the loading path.

This part is a bit blurry too. what is "set dressing to disk" and do you mean I just load another scene with object with the loading path? How is tat achived?
 

Link to comment
Share on other sites

15 minutes ago, Yalf said:

I'm not sure I understand the example.
How can the python node influence the switch node above it? And is the python node supposed to send an int to the switch node? If so, how do I send a variable from the python node to the switch node?

Nevermind about this! I had some weird otls in my houdini map that messed with the python node, that part works now, thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...