Jump to content

Sign in to follow this  
M G

Multiple variables and slider in xpresso

Recommended Posts

Hello all,

I'm using a slider (0-100%) in Xpresso for animating an object that rotates. If I use a constant (for argument's sake lets just say 50), the start and end location of rotation are good, but in the middle there is a dip, and the rotation lags (ie this is not a linear equation). I could keyframe and make up the difference, but things would get ugly quick. As an example what I want is the constant start at 50, then dip to 45 at 50% then go back to 50 at 100%. I'm generalizing here, it might require more inputs than in one place (at 50%), but I'd like that the variable to transition smoothly, but be tied to the slider and not to keyframes. 

Is there an equation I can use, or a way to have multiple variables based on the slider percentage and have them transition smoothly? There are other functions linked to the slider so it has to work with the % slider.

I hope this makes sense, thanks for any suggestions!

Share this post


Link to post
Share on other sites

Have you tried a range mapper with a spline to control the relationship between input and output? Then the input could be a standard slider, and the output would be whatever the spline maps it to.

Share this post


Link to post
Share on other sites
  • Topic Author
  • Hi Cairyn,

    Thanks very much for the reply. I have not tried spline as a control with range mapper, mostly because I don't know how it works/have never used it. Does this mean I can make something like a bell curve as input for the range mapper? This would make sense, as I need the same value at start and end, but in between end points it slopes up and then back down. I'll look into it if this is the case. Is this the general idea?

    Thanks!

     

     

    Share this post


    Link to post
    Share on other sites

    In the range mapper horizontal axis is input, vertical is output. You can set the numerical ranges inside the node or exxternal using math multipy etc - then the range map is a 1 : 1 map with spline shape as response curve.

     

    The spline has the usual bezier handles - use ctrl click to make points, and you can clamp the max + min of input and output. Without clamp, RM calculates a corresponding output outside the set ranges - can give unexpected results.

    rangemap.c4d

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Thanks Jed for explaining this! I found a tutorial as well that explains this but yours has better info. I think this should work for what I'm trying to do. 

     

    Many thanks!!!

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • Hi all,

    It's kind of odd but I think I try everything, start to write a reply stating it doesn't work, and as I'm writing the message and noting all the details I find some thing I missed and it works. This might be premature but I'm getting it to react at least and am closer....

    For those using a slider with percentage to control (0-100):
    Node Properties:
    Input range: User Defined
    Output range: User defined

    Use Spline 

    Parameter:

    Input lower - 0
    Input Upper- 100

    Output lower- Low end of range

    Output Upper- High end of range

    X axis (horizontal) - Represents slider from 0-100%

    Y axis (vertical) - Represents output range (0 is lower, 1 is upper)

    Thanks for all the input, much appreciated!
     

    Share this post


    Link to post
    Share on other sites

    Can I add that 0-100% on a user data slider (and the GUI) is represented as 0-1 in XPresso. If you use user defined values of 0-100 in range map, you might find things are out by a factor of 100. 27% = 0.27 etc.

     

    Same applies to rotation - degrees in the GUI are radians in XPresso -  this time you'd only be out by a factor of 57 😁. Also applies to user data sliders with degree as unit - 30 deg on a slider is 0.52 inside XPresso.

     

    These things caught me out when I first started with XPresso. Best to hang result nodes on ports to check values.

    Share this post


    Link to post
    Share on other sites
  • Topic Author
  • yes, I'm still figuring that stuff out...the rotations especially!

    Share this post


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

    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.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×
    ×
    • Create New...