Jump to content
Yalf

If-Node in node network

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

Share this post


Link to post
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

Share this post


Link to post
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?
 

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

×