Jump to content

Container project: a simple/complex question


Recommended Posts

Hi all,

I'm using Houdini for my project/portfolio and the main scene is a big beach filled with containers randomly created as the attached scene can show you: actually there are just simple boxes that will be replaced with the hires container, the red is for simple hatchs, while the green are are for windowed hatchs.

The scene works fine for me, but I'm trying to squeeze Houdini for a better learning!

The containers are distributed by a copy/stamp mechanism, but I want to make a step over.

There are some user controlled parameters, the one I'm getting trouble is called "rotator": it's a float parameter (0.0<->1.0) that should indicate the total number of copied containers and it'll works like a 180° distributor, i.e. where 0.0 means no container is turned on 180°, 1.0 means all containers are turned on 180°, and in between means that percentage of randomly choosen containers will be rotated.

I'd like to know if there's a way to put a complex expression or a little script in a parameter and where I can find informations about it, because I suppose there are no nodes to do that.

I thought to use a code like this (pseudo code):

i = 0
while (i &lt; $NCY * rotator)
  if (rand($PT), 180 AND i++, 0)

dispenser_006.hipnc

Link to comment
Share on other sites

what about this?

if(ch("../masterControl/rotator") >= ($PT/($NPT-1)), 180, 0)

just bypass your switch1 for a while to ignore window variable and try above expression as turner variable

to randomize rotating of containers append sort SOP after point1 and set it's mode to random

for multiline expressions you can use python expressions, i can recall that hscript has multiline expressions too but i forgot the syntax

you can even use Vop Sops to do your complex math on per point basis and add attribute to points then just use that attribute's variable for copy stamping

Link to comment
Share on other sites

Hi, anim,

thanks for the answer and thanks for your solution: it's really simple and it works flawlessly!

The formula is simple, but the use of Sort SOP (ehehe! a new node in the magazine!) gives me what I wanted.

for multiline expressions you can use python expressions, i can recall that hscript has multiline expressions too but i forgot the syntax

you can even use Vop Sops to do your complex math on per point basis and add attribute to points then just use that attribute's variable for copy stamping

For both solution, I think I'll postpone them after achieving a solid SOP base: Houdini is a great and beautiful beast in the end! ;)

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...