Jump to content
6ril

optimize copies - stamping or not - [SOLVED]

Recommended Posts

well, you don't need Instance SOP or Copy SOP or For to do that, and just to state my previous statement about Instance SOP more clearly, Instance SOP is just  an asset using Copy SOP inside, so if you want to see what is does, look inside and voila, copystamping and all that

so obviously you can create an attribute containing per point path to the file (including time offsets) and in Instance SOP or Copy SOP to stamp the File SOP path and get the same result, same speed

but if the speed is what you are after, then here are 3 ways you can use instead:

- you can just store your path as instancefile attribute on points and render using fast point instancing to get the result without copying or anything else

- or copy just any packed disk primitive on all the points without stamping and afterwards change unexpandedfilename intrinsics per prim to the exact path you want to read per file

- or if you are using packed alembics, it is abcfilename and abcframe instrinsics

I would go for packed alembics most of the times as they allow for interpolating geometry between frames, which is very handy for instances with constant topology

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

again, thx a lot for your help! I just realised that i used a wrong term in my prevous post. i did not mean the instance SOP. I had the instance object in mind.

and related to the three options you pointed out. would you mind setting up a little example showing one of the three methods. espacially the first one sounds interesting.

many thanks in advance!

cheers

Share this post


Link to post
Share on other sites

 

Hi Tomas,

 

thanks for those interesting examples!

 

a question regarding the purple option (1):

is it possible to expand this example with rotation and scale attribution?

 

I hope I am able to do the following (as efficient for large amounts of instances)

take an attributed point cloud (geometry path in houdini scene, rx, ry, rz, sx, sy, sz) and instance the defined geometries accordingly.

 

any input welcome. thanks in advance!

m.

 

 

 

 

Share this post


Link to post
Share on other sites

The instance sop, instance obj node, copy sop, all support attributes to alter the instances/copies as you describe. For scale its simply a vector @scale. Rotation can be handled in several ways, the most reliable one being a quaternion @orient.  Vex has an eulertoquaternion() function to help convert (it requires radians, I assume your values are in degrees).

In Tomas's scene, insert a point wrangle before 'create_per_point_instancefile_attribute', and assuming your attributes are named as you describe, this should work:

 

v@scale = set(@sx,@sx,@sz);

              
vector rotations;
rotations = set(@rx,@ry,@rz);
rotations = radians(rotations);

@orient = eulertoquaternion(rotations,0);

 

  • Like 1

Share this post


Link to post
Share on other sites

 

hi,

very cool. thanks for this. it makes sense.

 

though I have one other challenge on this.

the purple example references an external file via the attribute 'instancefile', while I'm trying to combine this with some knowledge from an other place, where an attribute called 'instancepath' was used, with an example of e.g. 'op:/obj/geo1/box1'. I'm not sure what the difference is, especially the meaning of 'op:'.

basically, in the workflow above, with the instance reference, scaling and rotating, I'd like to do this with nodes in the scene, not external files (for now).

 

on an other note:

how do you decide which expression or function you do in HScript, VEX or Pyhon? All examples I see everywhere are wildly mixing things, making it very confusing to understand the basic concepts (the @, the attr-->ATTR, and so on.). Is it possible to do everything consistently in Python (I'd prefer that), or would that be too slow / too much code / .. ?

 

Share this post


Link to post
Share on other sites

Thanks for that link. very useful again! I've seen there's a vex course on cgworkshops. This may be something for me. Though I'm not really a programmer, just sporadically doing scripts.

 

Hope getting an input to my other question in my last post. Thx!

Share this post


Link to post
Share on other sites

the instance obj node is hardcoded to look for the @instancefile attribute, documented in a semi-hidden place here:

http://archive.sidefx.com/docs/houdini15.0/nodes/vop/ptinstance

the instance sop can use whatever attribute you want, its default is @instancepath. They should probably be consolidated I guess.

The op: syntax tells houdini that its not looking on disk for a file, but rather to browse the nodes of your scene.  (op = operator, eg sop, dop, cop etc)

 

 

 

 

Share this post


Link to post
Share on other sites

hmm.

I am using instancefile (also have tried instancepath) as the attr now, I can see it in the geo spreadsheet of the instance node. the attr is a prim attr, on 5 faces, with different values:

op:/obj/geo1/a
op:/obj/geo1/b
op:/obj/geo1/c
op:/obj/geo1/a
op:/obj/geo1/a

though the instances are not rendered .. does this only work if the 'instance base geo' is points?

Share this post


Link to post
Share on other sites

From my quick experiment last night, the instanc obj node doesn't support op: paths, so you'd have to write your stuff out to .bgeo files on disk. I might be wrong, but I believe Tomas's setup was the same. 

The instance sop lets you use op: syntax however. 

Share this post


Link to post
Share on other sites

 

YESSSAA. now it works. on small scale for now. hope this will scale nicely.

thanks so much for the inputs! MUCH appreciated! :D

Share this post


Link to post
Share on other sites

Hey guys

Jumping quickly into your thread as i'm bumping into trouble while trying to offset the animation of my instances (using Redshift point instancing here) and sync the start of each instance animation with the birth of the particles. Right now it's only looking at the absolute time and playing instance animation in sycn regardless to the moment the partiucle instancing them is being born. I'm very reluctant to use Copy SOP and stamping and i'm hoping to find a simple solution to do that with Instances. Would you please be so kind to show me how to?

Cheers,

A.

Share this post


Link to post
Share on other sites
Posted (edited)

Bump! There should be some easy fix for that... @anim ?

Option with packed disk geometry working, but something wired going on with my mesh in random frames. Se example for frame 73:CopyToPointsAnimation_01.thumb.gif.341f575e2ce42cdaae553f10ec474be6.gif

Anyway, the Alembic workflow is better, so I need to figure out what is wrong with it.

NIS_copyStamping_001.hipnc

Edited by kiryha

Share this post


Link to post
Share on other sites

Sorry, Mate. Couldn't figure out what was wrong with your .abc file earlier. Hopefully someone better skilled will jump in. 

A.

Share this post


Link to post
Share on other sites

I don't think the issue is with alembic file, I just convert *.bgeo.sc sequence to *.abc with the default settings. 
The result would be the same with any other ABC, I tried another one from Maya, simple sphere deformation, no luck as well.

Share this post


Link to post
Share on other sites

What version/build of houdini are you using? I found that the version I was using had a bug in it - the latest build / an older build sorted it for me

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×