2 questions - understanding an expression, and caching a sim

   3429   4   3
User Avatar
Member
8 posts
Joined: 6月 2011
オフライン
Hi,

I've been experimenting and following some tutorials and have 2 questions.

The first relates to this expression:

fit01(rand($OBJID),.1,.7)

This is used in a tutorial to assign a value to a randomly chosen OBJID. I would then generate another random value which would be the value assigned to the OBJID, so for example OBJ 1 would get a value of .3, OBJ2 a value of .6 and so on. But when I paste it in different channels, the same value is displayed in each one. I don't understand expressions well so am probably missing something obvious.

My second question relates to caching sims using a file node inside a DOP. Inside a DOP I have a small flow that ends with a rbdsolver. I have tried to connect this to a file node and set the mode to write, but no files are written when I run the sim.

Any help appreciated,

thanks,

g
User Avatar
Member
2624 posts
Joined: 8月 2006
オフライン
Hi ,

What tutorial are you referring to ?, as the expression looks valid. With reference to the file dop. I have not had any issues with it.Do you have a simple scene file you can post.

As Erik mentions below which I missed do add a seed value ie fit01(rand($OBJID + 0.3),.1,.7)

Rob
Edited by - 2011年6月25日 06:31:44
Gone fishing
User Avatar
Member
300 posts
Joined: 1月 2010
オフライン
The $OBJID will be the same in each channel for the same object. Therefore the rand expression will use the same seed and always return the same result.

On the File part i haven't had any problems like circusmonkey but usually prefer to use the ROP Output node instead.
Drive, monkey, drive!
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
オフライン
I always add a different seed value to the variable when using rand() expressions:

fit01(rand($OBJID+1.001),.1,.7)

fit01(rand($OBJID+100.001),.1,.7)

fit01(rand($OBJID+ 345.9034),.1,.7)

Any number will do just to get a different seed value in to the rand() function.

Vary this seed each time you use the expression in the scene file for each parameter.

$OBJID is used in DOP networks and returns the current DOP object id number being processed. The parameter containing the expression will use the first DOP object it sees even if there are hundreds of dop objects being processed.

You can see the varying values if you go to the Details View for the DOP network and inspect the value that you are affecting for each DOP object.
There's at least one school like the old school!
User Avatar
Member
8 posts
Joined: 6月 2011
オフライン
Thanks so much for the replies guys, they are very insightful and I understand the rand function and concept of seed better now.

As for the file node, I have re-created my scene now from scratch and it works as described. I don't know what I had set up wrong before, or overlooked, but it's fine now.

Thanks again,

gubar
  • Quick Links