Jump to content

Ramp Parameter


Recommended Posts

  • 2 weeks later...

I've never used a ramp parameter either. From a cursory glance, it looks like you need to do something like this:

1. Create a UT_Ramp member variable to you class. eg.

UT_Ramp myRamp;

2. Override OP_Node::getRamp() in your own class to return this data. eg.

virtual UT_Ramp* getRamp (void) { return &myRamp; }

3. Add the ramp parameter to your template, along with a FLT_J parameter to do the lookup. eg.

PRM_Template

SOP_MySop::myTemplateList[] = {

...

PRM_Template(PRM_FLT_RAMPEDIT, 4, &MyRampName),

PRM_Template(PRM_FLT_J, 1, &MyRampUName),

...

};

4. To evaluate your ramp, obtain the u value and then use that to index into myRamp. eg.

float vals[4];

float u = evalFloat(MyRampUName.getToken(), 0, t);

myRamp.getColor(u, vals);

I have no idea whether any of this will work of course ... If you figure out, make sure to add it to odwiki. :)

Link to comment
Share on other sites

Hi edward :)

just to say that your suggestions are perfect...works like a charm.

The secret is to override the getramp() and put into it some functions...i only had to populate the ramp with two colornodes

UT_Ramp*
SOP_MySOP::getRamp(void)
	{ 
  if(myramp.getNodeCount() < 2)
  {
 	 myramp.addNode(0,UT_FRGBA(0,0,0,1));
 	 myramp.addNode(1,UT_FRGBA(1,1,1,1));
  }

  return	&myramp;
	}

The only bad thing is that seems that we can only use one ramp per SOP (the color POP works in the same way, you cannot use one ramp for the color and another for the alpha of particles)...

You know some way to include two distinct ramp parameter in the same SOP that do not shares color nodes?

This could be very usefull...you can modulate a lot of things with color ramps...

Anyway thank you very much for your help :)

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