Jump to content

no local variables in carve SOP node?


schnelli

Recommended Posts

Hi,

unfortunately, I recognized that it is not possible to use variables within the carve SOP node. What I want to do is using an expression for "First U" and "First V" within the carve node, depending on custom primitive attributes. It is neither possible to use custom primitve attributes, nor the standard $PR variable within the carve node parameters. But as far as I know, the carve node itself runs in a per-primitive context.

The only way to access primitive attributes in conjuction with the carve node is to build a foreach construct...but this is very slow.

It would be great if anybody knows another, faster solution.

Thanks a lot

Link to comment
Share on other sites

Hi Christian,

I tried with a simple grid, and it seems that carve SOP could take the values from the stamp function, so I did a copy of each primitive.

I don't know if that could be useful in your case, maybe with complicated models it's a bit hard to rebuild it in this way... but it's a way.

Maybe there are other functions that carve SOP accepts.

Cheers

Emanuele

carve_with_var.hipnc

Link to comment
Share on other sites

Hi Emanuele,

thanks a lot for your answer! The stamp function works fine in the carve tool, thats right!

My problem is, I cannot use the a copy node, since I have a fixed source geometry. This geometry consists of polygon curves and for each of these polygons I added primitive attributes with my desired (and animated) u/v-carve as value.

The only thing what is working for me is a foreach construct over all primitives and getting the custom attribute via the prim(..) expression using stamping as primitive number. But this is very slow...too slow for my purposes...

Link to comment
Share on other sites

Hi Emanuele,

thanks a lot for your answer! The stamp function works fine in the carve tool, thats right!

My problem is, I cannot use the a copy node, since I have a fixed source geometry. This geometry consists of polygon curves and for each of these polygons I added primitive attributes with my desired (and animated) u/v-carve as value.

The only thing what is working for me is a foreach construct over all primitives and getting the custom attribute via the prim(..) expression using stamping as primitive number. But this is very slow...too slow for my purposes...

Here is a solution I came up with a couple months ago where I had a lot of poly curves that I needed to carve with an attribute. It needs a little refining but could easily be turned into an Digital Asset.

If you look at a Carve Sop and what its doing, its essentially clipping the geo either > or < the carve threshold. In order to clip the geo at that threshold, it needs to have a point there (or slightly behind it). Essentially, I take the curve, set where I want to clip it via the point_CARVE_AMT Sop and then I move a point to that location. Using primuv() I can slide the point along the curve based on what I have my point_CARVE_AMT set to. I merge this point onto the existing curve by rebuild it and sorting the points. The Delete SOP deletes any pts > or < (whichever you set) to that CARVE_AMT.

The one issue I had was that I couldnt do a channel reference in my delete SOP to my point_CARVE_AMT Sop. Im sure if you looked into it a bit further you could come up with a way to solve that. In this example though, you need to manually match what you have in the CARVE_AMT and delete.

Not sure if this make sense so let me know if you have any questions.

HTH

spencerCarveWithAttr_001.hip

Edited by SpencerL
Link to comment
Share on other sites

Here is a solution I came up with a couple months ago where I had a lot of poly curves that I needed to carve with an attribute. It needs a little refining but could easily be turned into an Digital Asset.

If you look at a Carve Sop and what its doing, its essentially clipping the geo either > or < the carve threshold. In order to clip the geo at that threshold, it needs to have a point there (or slightly behind it). Essentially, I take the curve, set where I want to clip it via the point_CARVE_AMT Sop and then I move a point to that location. Using primuv() I can slide the point along the curve based on what I have my point_CARVE_AMT set to. I merge this point onto the existing curve by rebuild it and sorting the points. The Delete SOP deletes any pts > or < (whichever you set) to that CARVE_AMT.

The one issue I had was that I couldnt do a channel reference in my delete SOP to my point_CARVE_AMT Sop. Im sure if you looked into it a bit further you could come up with a way to solve that. In this example though, you need to manually match what you have in the CARVE_AMT and delete.

Not sure if this make sense so let me know if you have any questions.

HTH

Hey, thanks a lot! This solution works good for me.

Using NURBS curves as input makes this a little bit more complicated...oh, it's a pity the carve node does not support variables...it could be so easy... ;)

Thanks a lot for your quick answer!

Christian

Link to comment
Share on other sites

Hey, thanks a lot! This solution works good for me.

Using NURBS curves as input makes this a little bit more complicated...oh, it's a pity the carve node does not support variables...it could be so easy... ;)

Thanks a lot for your quick answer!

Christian

How is it making it more complicated? Not sure I understand, it should be interchangeable.

Link to comment
Share on other sites

How is it making it more complicated? Not sure I understand, it should be interchangeable.

Other than by polygons, the points in NURBS curves are control points....changing the end point without changing the control points would change the curve shape (unless the curve is straight linear).

The carve tool itself changes the control points of NURBS curves accordingly to the FirstU/SecondU parameter to keep the exact shape of the curve.

Edited by schnelli
Link to comment
Share on other sites

Other than by polygons, the points in NURBS curves are control points....changing the end point without changing the control points would change the curve shape (unless the curve is straight linear).

The carve tool itself changes the control points of NURBS curves accordingly to the FirstU/SecondU parameter to keep the exact shape of the curve.

Could you either, apply a resample SOP to your nurbs curve to convert it to a poly, or set your nurbs curve order to 2?

Link to comment
Share on other sites

Could you either, apply a resample SOP to your nurbs curve to convert it to a poly, or set your nurbs curve order to 2?

That's right, depending on the shape and number of curves, resampling and converting to polys would mean there are much more points to cover. That's the disadvantage...but of course, resampling with a adequate number of points is the only way I currently know without a deeper need of programming.

I just tried to avoid resampling, because I will have more than 50.000 control points of NURBS curves....and the process following after the carving slows down rapidly the more points I have...

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...