Jump to content

Parameter Interface - Expression entry


Recommended Posts

I am trying to make a field where I can enter an expression and just have that expression referenced into a node.

What I am trying to do with it is really just for fun, but I am trying to make an implicit surface generator that uses 2 functions and 4 lines setup in a six pointed star formation with a skin node to make the surface. I have most of it working, but I am trying to figure out how to make a parameter interface and actually have it work. So far, I am trying to just use a float expression, but it doesn't seem to be working all that well (well, at all really). Is this something that needs a stamp reference? To apply the functions to the geometry, I am using Point SOPS after I position and resample my lines. Also, I don't seem to be able to use an average of the 2 functions for my 45 degree lines, which is frustrating and odd. I should be able to just reference the two functions in an (F(tx)+G(tz))/2 to get the average of the two functions, which should give the values for the two other lines. It works if I simply enter individual functions, but I can't seem to get any references working for it.

Also, I am having some trouble closing the surface easily, does anyone have any suggestions?

Link to comment
Share on other sites

Trying to figure out how to do it for future projects where I might want access to it in a digital asset. I haven't gotten around to trying the suggestion above, some new quandary's have taken my attention, but this is definitely something I will want for reference. I am thinking of doing a digital asset tutorial for this month using the ability to input a math function to build a procedural space ship.

One other quick use the Multiparam Block options in the folders on an interface? The project I want to do involves cross sections, so this would be ideal to use for creating each cross section and a nice thing to know anyways. How do I access the stuff in SOPS to create new geometry like I am describing.

Link to comment
Share on other sites

why do you need the actual expressions in the other parameter?

ch("function1")+ch("function2")/2

??

Oh, and i forgot to mention why you can't use (ch(1)+ch(2))/2

It doesn't work on point sops. Try it. Just use 3 lines with vectors pointing along the x axis and offset their centers offset along the z axis. Then resample them with a Max segs of something like 9 and append a point sop to them. In the first line point sop for ty, put in $TX^2. For the third, put in $TX^3. In the second, put in (ch("../point1/ty)+ch(point2/ty))/2 and see what happens. At least when i did this, the middle line did nothing.

Link to comment
Share on other sites

of course it doesn't work if you use local variables like $TX

on the parameter you are inputting your function into $TX means nothing (it evaluates to 0), even if it can work on that node it will return 0 if referenced. So your whole function is evaluated with zeros instead of local variables and therefore you get incorrect numbers

the solution Edward provided eval(chsraw()) works ok, I've used it several times for similar reasons

your referenced parameter should be string and you can write complete function including $TX and other local variables which Point SOP can use, It will be evaluated as expression directly written into Point SOP parameter and therefore it will behave correctly

Edited by anim
Link to comment
Share on other sites

Thank you so much Tomas. That did exactly what I was hoping it would. Now I am well on my way to developing a nice, robust surface modeling system based around math functions and their associated graphs. I am so glad to have this stuff in my bag of tricks now, and hopefully after I write the tutorial tomorrow, other people can add them too. Thanks.

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