MrFurious
Hey Everyone, 

I have two questions.

I've built a little gui for a basic scatter setup and it all works well.  The problem i seem to be having now is that whenever i open a scene with the point node it re-calculates my random rotations, scale, object index. etc....

this is causing an issue with rendering.  is there a way to once i have my system setup to bake out the random scales, object index and rotations coming from the point node?

I am already baking the positions to curves.

Secondly and in the same system.  I would like to follow the surface normals and I have the node network setup that it works great, but I want to randomly rotate each "blade" of grass around its axis.  but when i go down the method of using the bounding volumes i can't seem figure out who to add in that randomness but still follow the normal.

additionally i've played around with mesh2array/copier and hit the same wall.  The bigger problem is that specifically with copier I want to use an Arnold standin and since its not a real mesh it will not work.  (but it works with the scatter node method since i'm using the native maya instancer).

any thoughts or help?  let me know if you want me to post an example file.

Andy



Reply 0 0
MrFurious
also I need to avoid baking out the instancer because of the sheer number of instances i need.
Reply 0 0
pshipkov
random functions usually do that.
look at the "seed" command - it should make the random pattern consistent.

as for the mesh2arrays node - will check and get back to you.
Reply 0 0
MrFurious
Thanks Peter!

I had to rework my expressions a bit, and I haven't used the seed command yet... but I got it working like a charm!  Any thoughts on random axis rotation along the normal?

i'll send some screen shots of my setup tomorrow.

thanks again,

Andy
Reply 0 0
plarson
To give a random aim to your instances using arrayToDynArray and Point. You can take the surface normal values from pointAttr2Array, or if you're using scatter you can use pointOnMeshInfo to get closest point on surfaces' normal. Put the normal values into inNormalPP on the Point node. Then do a seed(1); in the starting block, and add something like +rand(-.5,.5) to the variables in the Normal section of the point node. Then output those values to the arrayToDynArray with it set to aimDirection. It should work, scene attached. ma pointInst_aim.ma    
Reply 0 0
Pizzaman
In the point node, just use a seed per instance to make the random consistent per point :
seed($ID);

For the random rotation, if you use the normal as aimDirection, you should use the binormal of the mesh as aimWorldUp. To do that, transfer the binormal (pointAttributeToArray) to the normal of a new mesh, and query it thanks to the pointOnMeshInfo. Once you have that, you can create a randomly rotated aimWorldUp :

vector $N = <<$NX,$NY,$NZ>>;
vector $Bi = <<$NX2,$NY2,$NZ2>>;
vector $Wup = rot($Bi, $N, rand(-3.14,3.14));
$NX = $Wup.x;
$NY = $Wup.y;
$NZ = $Wup.z;

Enjoy !

Reply 0 0
Pizzaman
And as you can see, with SOuP, you have one solution per user :)
Reply 0 0
MrFurious
pizzaman would you mind setting up a small example. i think I follow what your doing but i'm getting an error on the expression in the point node and i'm not sure where its going wrong.

here is what i have. see attached.
Reply 0 0
Pizzaman
Check this :

It illustrates the use of binormals and normals, and the way to rotate them.
Because you can't query directly the binormal of a mesh, you have to reconstruct a mesh where the normal is replaced by its binormal. You can then use the pointOnMeshInfo to get the new normal.
In my exemple, I've copied the binormals in the colors of the mesh to allow one mesh to carry all the informations. I then reconstruct the vector :
vector $Bi = <<$CR,$CG,$CB>>;

I've also dynamicaly baked the input points as a NURBS curve. You can disconnect its input and move the points as needed.

Enjoy :)
 
Reply 0 0
MrFurious
Pizzaman,

Thanks a ton!  great example.  I've made a tool with GUI that automates a scatter setup and tweaking of its values, to make it easy for artists but was always baking out the instancer when ready to render.  Now with your and everyones help from this post i've made so i don't have to bake it out!

i'm going to update my code and share it with everyone.  Stuff like XGEN might make this tool moot in but for those without XGEN render support this is a handy tool.

Thanks for helping me wrap up the bits i couldn't figure out.

I'll post it sometime next week when i get back to work on it.

thanks again.

Andy
Reply 0 0
MrFurious
Hey Everyone,

Again thanks for the help.  I've had this tool working partially for a while but now it's as done as its going to get for now.

The only limitation is one mesh per scatter system.

I "Think" I got out all the UI bugs.  But this allows you to easily create and edit a mesh based SoUP scatter system with the maya instancer.

Enjoy!

Andy

simply place both py and ui files in your script directory (in the same place) and run this command.

let me know if there are anybugs, and excuse the messy code! (please don't judge me... i'm not a full time dev guy, just a cg hacker.)  :)

import awSoUPScatter

reload(awSoUPScatter)

awSoUPScatter.awUI()

soupScatter.jpg
Reply 0 0
Pizzaman
You're welcome.
You can check the "Grass tool for SOuP users" post if you want a full and more controlable exemple.
What I've sent you is a little piece of the whole tool that might interest you.
Enjoy !
Reply 0 0
pshipkov
Very cool.
I was talking to some people the other day about exactly this - SOuP has all components needed for comprehensive layout system, but the workflow is not there. Thanks for sharing this tool with us.
There is a syntax error at line 337 - space between "Arrays".
Reply 0 0
MrFurious
i'll check out the error.  i'm also adding a hacky LOD system.  I've inserted a group and deleteComponent node right before the scatter node.  Then i'm going to make a button that will active the group node and insert a pre and post render mel to turn off the group node so when it renders it gets the full system but when displayed it gets a smaller subset of the scatter points because the mesh is decimated.

i'm getting a bit lazy as i have to finished the tool for what I need but there are things i want to add....  thanks for the feedback!

Andy
Reply 0 0
Reply