How rand is rand($PT) in Copy Stamp

   21255   8   2
User Avatar
Member
436 posts
Joined: July 2005
Offline
I am instancing some rocks on a dry river bed for my flood scene. sing Copy with Stamp parms.
I have stamp params for three instanced objects, with four params for each. rotX, rotY,rotZ, and ScaleU. Named as such. Addional stamp parameter in switch SOP for instance randomization. The point group is provided by POP Network that is frozen.
In Copy Stamp parameters I have the following expression for each rot channell

For example. Inst01_rotX , is controlled by fit(rand($PT),0,1,-180,180) exp. In Copy Stamp params tab.
Similar expressions for other channels.
Scale stamping is controled by following expression
Parameter: Inst01_ScaleU exp. fit(rand($PT),0,1,.01,.15)

The issue I am having is that rocks near other don't have much of difference in rotation. I am wondering is having point numbers that are close together would generate random numbers that are similary close together.

Perhaps there is a better expression for randomizing of instance transforms.

Additional question. Should Copy (with Stamp) better done in Instance instead of Geometry. Is Instance, as opposed to Geometry, is equivalent to Maya's Instancer.

I have attached the samples.

DaveR

Attachments:
V08_Playblast.0054.jpg (90.2 KB)
V08_Playblast.mov (951.0 KB)

User Avatar
Member
606 posts
Joined: May 2007
Offline
DavidRindner
The issue I am having is that rocks near other don't have much of difference in rotation. I am wondering is having point numbers that are close together would generate random numbers that are similary close together.

It's probably a good idea to multiply the values with a different number on each channel.

e.g. rand($PT*118.12) for rotX and rand($PT*21.98) for rotY etc.
(you can do anything as long as the result is always the same for same $PT)

DavidRindner
Additional question. Should Copy (with Stamp) better done in Instance instead of Geometry. Is Instance, as opposed to Geometry, is equivalent to Maya's Instancer.

Depends on complexity of the instanced geometry. Read http://odforce.net/wiki/index.php/MantraInstancing [odforce.net]

eetu.
User Avatar
Member
436 posts
Joined: July 2005
Offline
Thanks

Actually I used $PSCALE as multiple. So my expression for randomizing instance rots is

fit(rand($PT * $PSCALE),0,1,-180,180)

$PSCALE is also used as instance scaling.

Instance switching is controlled by exp. int(fit($rand($PT),0,1,0,2.5))

So here is my question. For a given point number, is the random number same all the time every time. In Maya world, instance ID's, instance rots, and scales are baked into stamping points during caching. This is a requirement for consistent rendering.
User Avatar
Member
606 posts
Joined: May 2007
Offline
DavidRindner
So here is my question. For a given point number, is the random number same all the time every time.

Yes.

rand($PT) will always be the same for a given point.

rand($PT*$PSCALE) doesn't really make sense to me. You want the seed for
the random function to be a constant, so you should multiply by a constant.

Is there a particular reason why you would like to have $PSCALE in the
expression? There is probably a better/correct way to include it.

eetu.
User Avatar
Member
436 posts
Joined: July 2005
Offline
What I have been experiencing is that instance rotations of neighbor instances to be similar.
So when I use a constant multiple in the expression say 3.14 for
fit(rand($PT * 3.14),0,1,-180,180), the rotations of neighbor instances are not randomised enough. However becouse $PSCALE has large value range from , .01 to .2. Using it in the expression fit(rand($PT * $PSCALE),0,1,-180,180), generates significant differences in rotation of instance neighbors.

DR
User Avatar
Member
606 posts
Joined: May 2007
Offline
If $PSCALE is not a constant, the rand() for a given particle will get a varying
seed and the output will be inconsistent.

If $PSCALE is a constant, you could just use a numerical constant and there
would not be danger of a varying seed. If you use a big number, e.g.
rand($PT*700000.811), the seeds for consecutive particles will be very
different.

eetu.
User Avatar
Member
696 posts
Joined: March 2006
Offline
if these are particles, shouldn't you be seeding based on $ID?
Stephen Tucker
VFXTD
User Avatar
Member
436 posts
Joined: July 2005
Offline
Thas actually great advice . Thank you.

So my exp. in instance rots should
fit(rand($ID),0,1,-180,180)

I thought that $PT is point number, and its different for every point. Since I bake my POP into BGEO , then load it back via fileIn.

DR
User Avatar
Member
1390 posts
Joined: July 2005
Offline
DavidRindner
Thas actually great advice . Thank you.

So my exp. in instance rots should
fit(rand($ID),0,1,-180,180)

I thought that $PT is point number, and its different for every point. Since I bake my POP into BGEO , then load it back via fileIn.

DR

This is correct, but when points count changes, $PT is no longer stable variable, while $ID stays the same (since it's never repeated in a single simulation).
  • Quick Links