i3d variable frequency

   2357   0   0
User Avatar
Member
4 posts
Joined:
Offline
Hi All,
I'm writing a new i3d shader to store more data than just density…

I'm trying to vary the frequency parameter in the VEX meta cloud shader based on the size of the metaballs. Basically, I want to have the frequency to be proportional to the radius of metalballs.

I created a RAD attribute which stores the size of the metaball (the radius). I then read this parameter using mattrib. The result that I get is close but not entirely correct. This is the relevant part of the code..


forpoints(P)
{
radius=mattrib(“RAD”,P);

//radius=1.0;
//printf(“radius %f\n”,radius);
scaled_freq=freq*radius;

}
then compute the noise using scaled_freq….

If create a single metaball with size of 1.0, the radius variable should be 1.0. However if I print radius in the loop I can see values of 1.0, 0.0 and other numbers. The RAD attribute has the correct value (1.0). As you can see from the image (right) the edge seems cropped.
If on the other hand, I hardcode radius=1.0, the result is what I expect (left of image)

Where I'm I going wrong??
Thanks!

I then use scaled_freq to compute noise.

Attachments:
metaball.jpg (18.2 KB)

  • Quick Links