Jump to content

[SOLVED]Instance Animated Geometry With Time Offset?


Atom

Recommended Posts

Hi All,

I have an animated palm tree that loops every 360 frames. Currently I am deploying many copies of this using the Copy/Stamp approach with a random frame number being stamped into the Frame field of a Time Shift node. This works, but is slow. I would like to leverage instancing so I can increase my count and performance but I can't figure out how to implement the time offset using instancing.

As far as I can tell you can only specify a single object for instancing. One solution would be to create 360 objects, each with a File node inside, pointing to the various frames of my animated palm tree. This seems a bit ridiculous to me and I wonder is there some other way to cause instancing to reference alternate frames in a geo sequence?

Here is my VEX code for instancing so far which does deploy 5 different static trees.

i@instId = int(rand(@ptnum)*5)+1;                       // Instance index required for Houdini instancing.
s@instance = sprintf("/obj/geo_palm-%d", i@instId);     // Used by Houdini and Redshift.

// randomize scale
v@scale = fit01(rand(@ptnum+801),1.8,2.8);

// Randomize rotation.
vector axis = {0,1,0};      // Axis to rotate.
float rand = 0;
vector4 quat = {0,0,0,1};
vector4 product = {0,0,0,1};
rand = fit01(rand(@ptnum+311),0,360);
quat = quaternion(radians(rand), axis);
product = qmultiply({0,0,0,1}, quat);
@orient=product;

 

Edited by Atom
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...