Jump to content

VEX: Ramp parameter code. Spline function?


evgen

Recommended Posts

Hello.

I have the problem with using ramp parameter in vex.

What code should i use for get it works?

Seems that i need to use spline() with a few arrays of values, as in the help, but compiler gives me a lot of errors with it.

How i need to use spline function for this?

Thank you

Link to comment
Share on other sites

You would have to be more specific about errors, but generally, since ramps are tedious to setup, what I usually do is that I copy code from any of SESI shaders with ramps :). ASAD light for example:

/*
 * PROPRIETARY INFORMATION.  This software is proprietary to

(...)


#pragma ramp_rgb        atten_ramp atten_basis atten_keys atten_values
#pragma parmtag         atten_ramp rampbasisdefault linear
#pragma parmtag         atten_ramp rampshowcontrolsdefault 0
#pragma parmtag         atten_ramp rampcolortype rgb
(...)

vector
eval_ramp(float t0; string basis[]; float keys[]; vector values[])
{
    return spline(basis, spline("linearsolve", t0, keys), values);
}

(...)

string atten_basis[] = {"linear", "linear", "linear"};
float  atten_keys[] = {0.0, 0.9, 1.0};
vector atten_values[] = {{1,1,1}, {1,1,1}, {0,0,0}};
(...)

 Cl *= eval_ramp(key, atten_basis, atten_keys, atten_values);

Edited by SYmek
  • Like 1
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...