Area :: Header
Interested in making Indie games?

Register for a Meet the Experts webinar with Digital-Tutors today!
Discussion Groups

Modeling

Reply
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Parametric Formula Plugin

574 Views, 22 Replies
03-18-2010 07:12 PM
With this thread, I will explain the Parametric Formula plugin.

Motivation.

I design the plugin to fill a need for generating shapes using parametric equations found over the internet. The plugin was as much an experiment with NURBS as it was with math formula.

Installation

Download the plugin here at the Area Download section. The plugin is called, of course, Parametric Formula. The plugin was coded using Softimage 7.01 so it should work with this version up. I have not tested the script with earlier version.

Decompress the file and Install it in your plugin directory of Softimage. This is a self-install plugin, it should be detected by Softimage on startup. If not, use the plugin manager to load the plugin.

You will found the plugin in your primitive selection menu.

Math functions

When the UI open up, you will notice the default setting of the sphere primitive. The plugin is coded in JScript and most math.functions have been implemented within. You will notice that formulas don't have the math prefix. That is because the plugin is coded to accept both version such as math.cos(n) or just plain cos(n).

Also coded are new math functions such as cosh, sign, ln and several others. In my next post, I will provide tables of these math functions and parameters.

Limitations

This plugin is slow. On my low spec machine (AMD 4400 X4 Dual core), I generate complex NURBS in approximately three to four seconds with subdivisions set at 100 for both u and v. I have limited the u and v subdiv to a maximum of 1000 (that is 1,000,000 Control points evaluated on 14 formulas/subformulas). If you want to stess test your machine, go ahead, but don't blame Softimage or your computer if they go on strike or worst, stand up and walk off your desk in protest.

The plugin does not include a complex number function. So if you provide formula that generate complex number such as sqrt(-1), you will not see a nurbs surface on screen or in the quick render. Some formulas can be made to remain within the real domain by restricting the u min, u max, v min and v max. Check the kiss surface preset for an example where v max was restricted to less than 1 to prevent the formula to calculate imaginary numbers.

The plugin create one Nurbs surface. If you need to generate multiple surfaces, you will have to generate the object in piecemeal or, if you are a programmer, modify the code to feed the nurbs count of AddNurbsSurfaceMesh2.

Be aware that the plugin will create self-intersecting surfaces, non-manifold and internal control points, edge and polys. Softimage and Mental Ray will throw warning during render, but so far, it has provided good render for me.

Your render will show a nasty seam, that it because I have coded the surface to overlap control points in order to close the surface. You can avoid the seam if you generate the surface with linear degree, or use the nurbs to mesh to convert it to poly (work sometime).

Presets

I have provided approximately 121 presets with the plugin, open them up and check them all to see how to enter formulas and generate nurbs and meshes. Don't forget to lock the UI if you want to experiment. Start with the plane and simple formulas like the saddle.

Because you are working with Nurbs, you will notice the x, y, z, and w in the interface. The w parameter control the weight influence of that control point on the nurbs surface. In most cases you will leave the value to it's default of 1. One preset for the sphere has an example where I fed the w with a sine function. The result was a slicing of the sphere. The w is an interesting twist in generating parametric equations.

So have fun with NURBS, mathematics and parametric formulas in Softimage!

Cheers!

Dan
Please use plain text.
Distinguished Contributor
Leendert68
Posts: 347
Registered: ‎10-01-2010

Re: Parametric Formula Plugin

03-19-2010 01:14 AM in reply to: DanCanada
Nice...
Might be a good idea to mention that the download can be found in the download section here @ the Area...
Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 05:01 AM in reply to: Leendert68
Thanks Hirazi Blue. I have corrected my earlier text. Cheers!

Dan
Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 05:33 PM in reply to: DanCanada
Here is a quick view of the UI.

Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 05:36 PM in reply to: DanCanada
And of the presets

Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 08:18 PM in reply to: DanCanada
In my last post I talked about the math equation that this plugin can use.

The plugin is coded in Jscript. Jscript comes with its own mathematical functions and constants. You write them as follows

Math.constant
Math.function( )

But writing Math. is not intuitive, so I programmed small functions to take care of this. The plugin will still take the Math. form if you so desire.

By convention, Jscript constants are capitalized. Below is a table with the various functions:

Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 09:01 PM in reply to: DanCanada
The JScript Math Functions and .....

Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 09:03 PM in reply to: DanCanada
Expended functions

Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 09:09 PM in reply to: DanCanada
You write a function like so

pow((c1*c2),2)+sin(c3)


in the interface. when ready, press the button to create your nurbs and see the result in the viewport.

Look at some presets first to see how its done.

Good luck!

Dan
Please use plain text.
Distinguished Contributor
DanCanada
Posts: 163
Registered: ‎02-24-2008

Re: Parametric Formula Plugin

03-19-2010 09:23 PM in reply to: DanCanada
A few shapes created from the provided presets to wet your appetite!

Please use plain text.