Juzwa Posted December 16, 2014 Share Posted December 16, 2014 Hi, I made some procedural rocks. I assigned a simple expression $F on few attributes to get variations very fast and so I could wrtite out the rocks. So now I have a lot of rocks in one single file sequence. So now I want to use those rocks to model my surface. How can I use this sequence to get random rocks? Eg load a single random frame from that sequence Quote Link to comment Share on other sites More sharing options...
Sierra62 Posted December 16, 2014 Share Posted December 16, 2014 using a copy sop, enable stamp inputs and create a variable eg: rocks with a value of $PT. On your file node you are reading in using the following expression: $HIP/rocks_library/rocks.`floor(fit01(rand(stamp("../copy1","rocks",0)),1, 240))`.bgeo (assuming you have 240 different rocks, change this as needed.) Quote Link to comment Share on other sites More sharing options...
lukeiamyourfather Posted December 16, 2014 Share Posted December 16, 2014 Use a Copy SOP node, File SOP node, and Time Shift SOP node. Set the shift on the time to the value of the rock to load. I've attached an example scene file. Instancing could be another option depending on the nature of your workflow. If you don't plan to instance than writing the rocks to disk might not be worthwhile. rockLoader.hip Quote Link to comment Share on other sites More sharing options...
lukeiamyourfather Posted December 16, 2014 Share Posted December 16, 2014 Cody beat me to it, same concept but using an expression instead of a Time Shift SOP node. Quote Link to comment Share on other sites More sharing options...
Juzwa Posted December 16, 2014 Author Share Posted December 16, 2014 Thanks guys, this is what i was looking for! Quote Link to comment Share on other sites More sharing options...
Juzwa Posted December 16, 2014 Author Share Posted December 16, 2014 Hi, Unfortunately I still dont understand something. When I use your Illusionist scene everything works fine. But when I make exactly the same setup I get copied only one rock? I tried without timeshift node with this expression `floor(fit01(rand(stamp("../copy1","rocks",0)),1, 240))` but it evaluates to some 3 digit random number (eg 154). And I use 4 digits in files (eg 0154). And i get an error "Unable to read file.....154.bgeo" Quote Link to comment Share on other sites More sharing options...
lukeiamyourfather Posted December 16, 2014 Share Posted December 16, 2014 If using my example change the $F on the File SOP path expression to $F4 (padding of four). One of the stamp values on the Copy SOP is what actually picks the rock to use and change the max fit range to however many rocks you have. Quote Link to comment Share on other sites More sharing options...
iamyog Posted December 17, 2014 Share Posted December 17, 2014 [...] this expression `floor(fit01(rand(stamp("../copy1","rocks",0)),1, 240))` but it evaluates to some 3 digit random number (eg 154). And I use 4 digits in files (eg 0154). change it to `padzero(4,floor(fit01(rand(stamp("../copy1","rocks",0)),1, 240)))` Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.