Jump to content
catchyid

wire thickness (sparks like simulation)

Recommended Posts

Hi,

I have a simple simulation for sparks generation (plz see attached). Although I can generate the sparks and control their lengths as I wish, I cannot seem to know how to control their thickness, i.e. I want each spark to have a different size. I've tried three different method to vary the thickness but no works. In the setup, I use pop network to emit particles, then use add to create poly-lines for each spark, then:

-If I use wireframe node, I could not find any variable that changes the wire thickness per primitive, I've tried $PR but it does not work (the whole node gets reddish lines)

-If I use for each loop to scale each primitive alone, the transform node would scale the spark uniformly and although it's possible to try to orient the transform node with the spark such that it would be possible to scale the thickness only, it would require some math and I don't think it should be that "troublesome"

-If I use for each loop and generate each spark individually by sweep+skin, the circle that is used for cross section is outside the loop and it cannot be changed for each primitive!

 

Thanks,

 

sparks_thickness.png

laser_sparks_odforce.hip

  • Sad 1

Share this post


Link to post
Share on other sites

Just add a wrangle + the polywire create an attribute

in wrangle add this 

f@width = fit01(rand(@my_id + ch("seed")), .015, .075);

then in the polywire on the wire Radius add "@width"

attached is a scene with the changes.

laser_sparks_odforce.hipnc

Edited by Sepu
  • Like 1

Share this post


Link to post
Share on other sites

Hi Khaled,

 

The attribute you're looking for is width, it can control the render of a curve. You won't need to "skin" or make geo out of the curves in this instance if you're rendering with mantra.

 

So simplest way is in an attribute wrangle directly after the "add1" run over Primitives something like -

@width = fit01(rand(@primnum), 0.1, 0.5);

Then you can simply render them as curves, they will be flat (not round) but for most spark type fx i've found this to do the job

 

Edited by dayvbrown
  • Like 1

Share this post


Link to post
Share on other sites

Thaaaaaaaanks guys for your help :) One last question: I thought that we could not use attributes in VEX code only (i.e. not in HScript), but obviously, I am mistaken, so my question: is it always the case that we can use @attributes in HScript OR this example is a special case?

Once more, thanks for your help :)

Share this post


Link to post
Share on other sites

@attrbites are use in Vex, Im not using hscript anywhere on the wrangle that I added. 

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

×