Jump to content
6ril

optimize copies - stamping or not - [SOLVED]

Recommended Posts

Hi,

if you could have a look at this hip, I bet I'm doing it wrong cause it's very slow.

It's 2500 boxes (copysop + stamping) growing up.

I scatter points on a painted grid,
fuse points to avoid overlapping,
attributeVOP to randomize and add a fadeout effect.
 

I'd learn a lot if someone could point out the mistakes.
Might not be mistakes, but maybe there's ways to optimize.

I'm not comfortable with coding yet, so I couldn't wrangle this, but if I'm not mistaken, VOP is VEX, so I was expecting faster cooking.

Could it be slow elsewhere ? the copysop? I checked "packed geo bedore copying" just to see... still slow.
Or before the VOP? I unchecked "relax "iterations" in the scatter node to speed up the scattering, in case it was cooking it each frame, but no.

OR the number of boxes is the pb and there's no way to optimize? I doubt that as I've got heavier scene running smoothly.
 

if you have the time, I'd appreciate :)

 

thanks,

cyril.

optimizeBOX.hipnc

Edited by 6ril

Share this post


Link to post
Share on other sites

You can run the Performance Monitor and see that, at least on OsX, most of the time is drawing it in the viewport. If you add a RopOutput Driver Houdini will write the work out pretty fast.

Share this post


Link to post
Share on other sites

thanks for the quick! reply Marty :)

I was just looking at the perf monitor ! I hit record and played the animation.. got a big red glow on the copySOP and an orange glow on the BOX.

Does it mean there's no optimize to be done, other then a complete different approach?

 

Share this post


Link to post
Share on other sites

I've created a RopOutput Driver after the copy node, then added a filesop to read it back, but it's still slow :/ I'd say 1fps

by the way, it's the first time I use the " RopOutput Driver " usually I use a filecache node, and I don't have to make another node to read back, I just have to check the "read from disk" checkbox.
Is there a reason to the " RopOutput Driver" instead?

both seems to render to disk, but RopOutput Driver can't be displayed.

Share this post


Link to post
Share on other sites

Disable "Pack geometry before copying", it will be much faster to draw. You could use Cache SOP to store everything in RAM, and it will play in real time after caching.

Share this post


Link to post
Share on other sites

Can you just transform after the copySop? You can get ~80fps if you lock the CopySop.

Edited by marty
fps

Share this post


Link to post
Share on other sites
36 minutes ago, 6ril said:

by the way, it's the first time I use the " RopOutput Driver " usually I use a filecache node, and I don't have to make another node to read back, I just have to check the "read from disk" checkbox.
Is there a reason to the " RopOutput Driver" instead?

Dive inside the 'filecacheSOP' and you'll see the same RopOutput Driver wrapped in an HDA  Welcome to Houdini. ;)

Share this post


Link to post
Share on other sites

So it wasn't my way of building that scene that was responsible for the low performance, right?

I thought packed geo could be a benefit... I checked it cause it was slow in the first place. Using the cache SOP is very effective indeed! Tho, I gotta check how much ram it will take with 1500 frames ! :/

11 minutes ago, marty said:

Can you just transform after the copySop? You can get 20fps if you lock the CopySop.

transform after the copy sop ? hmmm dunno if I can do that, isn't that the point of the copy SOP? Can I still transform on a per box basis?

Share this post


Link to post
Share on other sites
4 minutes ago, marty said:

Dive inside the 'filecacheSOP' and you'll see the same RopOutput Driver wrapped in an HDA  Welcome to Houdini. ;)

:) Diving often give me vertigo !

Now I wonder why use the ropoutpout driver at all? If there is the filecacheSOP which is way more convenient. Did you recommand it cause of old habits ? Welcome to H15 :P

Share this post


Link to post
Share on other sites
2 hours ago, 6ril said:

Now I wonder why use the ropoutpout driver at all? If there is the filecacheSOP which is way more convenient. Did you recommand it cause of old habits ? Welcome to H15 :P

Never thought about it that way. Convenience isn't the main reason to use Houdini, but control is. The HDA supplied by SideFx is great to start out with but later on you don't want or need all the extra stuff.  BTW this applies to all HDA nodes, i.e.. Pyro, fluids etc. 

Share this post


Link to post
Share on other sites
4 hours ago, 6ril said:

...Does it mean there's no optimize to be done, other then a complete different approach?

no, there is plenty of optimization to be done

you are using copystamping which is very slow most of the times snce it needs to cook geometry for every copy especially if they differ so it can't be reused

if you just use scale attrib instead you will get much better performance without the need of caching it

optimizeBOX_fix.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

Tomas, fantastic solution ! Precisely what I was looking for.

it's now smoooooth and I can animate with comfort.

Can only click the like button once. I would have flooded you.

thanks a lot.

Share this post


Link to post
Share on other sites
6 hours ago, anim said:

if you just use scale attrib instead you will get much better performance without the need of caching it

Just to clarify things, for my sake (and maybe other beginners).

This works only because you are setting my f@height attribute to a "recognised"/"standard" attribute (scale), right ? (sorry if I don't have the proper vocabulary)

I mean I couldn't do that if I wanted f@height to influence let's say ..errr... a bevel amount of a polybevel node placed after box1, right ?

Or would it work if I type in the attribWrangle : f@absinset = f@height  (or something like that, cause I tried that and it's not working)

 

I'm just trying to properly understand when stamping is the way to go.

Share this post


Link to post
Share on other sites

Copy SOP recognizes specific transform attributes

http://www.sidefx.com/docs/houdini15.0/copy/instanceattrs

if you want to change per copy geometry in other way than transform, you'd probably have to stamp

OR if you still want to avoid stamping

you can let copies inherit your custom attributes and then use VEX or other nodes to modify the whole geometry after copying using those attributes for varying

for example you can copy on non animated points in rest state (so even if it's  heavy it will happen only once) and inherit name or id attribute from points , then use Transform Pieces to just move/deform that geo with animated points, which should be even faster for your case 

or you if you want to do per copy extrusion you can inherit some attributes from points that will then control Poly Extrude zscale, insetscale, twistscale, ... per copy, but after Copy SOP since the resulting geometry will have those attribs already different per copy, etc.

EDIT: by inheriting attributes I mean using Attribute tab of Copy SOP

Edited by anim
  • Like 1

Share this post


Link to post
Share on other sites

Use Stamping with Copy SOP when you want to create new geometry for every template point. For example an upstream Switch SOP or you are cracking geometry up differently for every copy.

Use Stamping when you want to evaluate other remote network nodes to provide data for attributes. One example is building up complex material shading strings. Actually I haven't done this since style sheets for H15 supported CVEX routines...

Don't use stamping in Copy SOP if you want to manipulate/orient the incoming geometry. There are a whole host of point attributes supported to scale/orient/transform the copied geometry. As well you can use local variables in the Copy SOP to do in-place scaling. Look at $PT (point number) and $ID (particle id's) to add randomness to your copies: rand($PT+1.001) in the scale x parameter will randomly scale inputs. See the Copy SOP help examples.

 

Do I recommend Copy stamping in H15 and beyond? Nope. Use the new For Each SOPs to do this. Much faster. No diving in to subnets as with the older For Each SOP stamping methods. And for render property and shading manipulation, use style sheets and CVEX shaders.

  • Like 2

Share this post


Link to post
Share on other sites

Anim and OldSchool, I got it all (I reckon) :)

Thanks a lot, really. For your time and knowledge sharing.

Sorry for asking about stuff that are in the doc, I sometime get lost in the doc, I see things and later I have a hard time finding it again :/ Gotta work on my terminology knowledge !

 

I'll rename the title into a more generic one, as I'm sure other can benefit from all the clarifications.

Share this post


Link to post
Share on other sites
On 5/13/2016 at 2:15 AM, old school said:

Do I recommend Copy stamping in H15 and beyond? Nope. Use the new For Each SOPs to do this. Much faster. No diving in to subnets as with the older For Each SOP stamping methods. And for render property and shading manipulation, use style sheets and CVEX shaders.

It would be great to see this written into the manual, as an addendum, as there a tons of references in older tutorials and forum posts. Thanks!

Share this post


Link to post
Share on other sites

Hi,

As i currently try to compare instancing/copystamping/forech. i'd like to bring up this thread which somehow points into a different direction as the posts above.

could someone enlighten me here...? Oldschools statement sounds like copystamping is outdated? Any hints?

Cheers

Share this post


Link to post
Share on other sites

In my experience, this changes very quickly as the optimizations are being done under the hood constantly and I'd rather not make conclusions that will not be true in a year. In my opinion Copy Stamping and For Each should eventually be the same speed if they are doing the same thing (but there were times when one was faster than another and vice versa).

there is many variables that come into play, like

- with Copy sop you don't have to stamp if you are using transforms, or just for per copy attribute assignment, in For you have to

- Copy SOP can cache stamped geometry, I'm not so sure if For can

so if you are in doubt, try your setup in Copy and For or Gas Repeat (or whatever else you think of) and compare, it will differ per setup

overall conclusions can be made, like stamping is slower than not, so as I said there are many situations where you can avoid it (without using For of course), but other than that, if you are doing the same thing using different tools it's about testing with Performance monitor

(there are threads with conclusions that Instance SOP is faster than stamping with Copy SOP, I don't want to bring up any spoilers, but look inside of Instance SOP)

Edited by anim
  • Like 1

Share this post


Link to post
Share on other sites

hey anim,

thank you for the insides. One further question related to this subject. Is it possible to use an attribute for timeoffset along with the instance SOP? I know it is possible to use expressions in the file/read node but that is certainly not the same thing.

here is an example done with a copySOP. can we achive that with forloops ore the instanceSOP, would such a solution be more efficient?

PW: random

cheers

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

×