Jump to content
evgen

VEX: Ramp parameter code. Spline function?

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks SYmek. Thats correct, i found this solution after posting this thread)

Maybe sombody find this information useful too.

Thanks again

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

×