How to use mathematical formula?

   7145   3   3
User Avatar
Member
1 posts
Joined: Oct. 2009
Offline
hi, im new to houdini, and would like to know how i can use a mathematical formula, in order to create mesh, and also to create particles…(i would like to emit particles with this formula and let the formula act as a force as well)

any information, links to tutorials, anything would be greatly appreciated!!

thanks alot!!!
eat my shorts.
User Avatar
Member
2199 posts
Joined: July 2005
Online
not so useful for particles but check out the isosurface sop.
The trick is finding just the right hammer for every screw
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
If you just want to modify existing geometry then you can use a Point SOP with expressions and a whole list of variations on that. See below.

If you need to build and modify geometry without resorting to the HDK, you need to create a custom Python SOP. See below.

As for creating particles, the way to do that is to do some SOP stuff that builds points every frame then feed that in to a POP SOP and in the Source POP, birth points in order, set the continuous birthing to 0 and use the instantaneous birth rate condition to 1 and the birth rate to $NPT or the total number of points being fed in to the POP SOP at that time. You can add whatever attributes to the points and they will be inherited in to the Particle system. Most common is to load the points with N Normals or v velocity vectors and the Source POP will use that as the initial velocity.

—-

Check out the expression cookbook in the Houdini help:
http://www.sidefx.com/docs/houdini10.0/ref/expression_cookbook [sidefx.com]
These examples are intended to work in a Point SOP's Y Position parameter on a Line or Grid SOP feeding it with a decent number of divisions.

Generally you will start out with either a Line SOP or a Grid SOP then apply a Point SOP and type in your expressions in to the position fields. Think of the Line or Grid as positions in space to evaluate your function with. To access the position of each point in your function, use $TX, $TY and $TZ for X, Y and Z positions respectively. If you wire in a grid on the XZ plane, it makes sense to put your expression in the Y parameter field and access the X and Z positions with $TX and $TZ respectively.

Next look at the available hscript functions in either the Houdini help or in the textport.
Open the textport with the hotkey combo alt-shift-t then type in exhelp to get a list of all the expression functions.

If the expression is getting too long in the parameter field, you can open the expression editor (alt-e) on that parameter and there you can put in carriage returns to spread out your expressions.

The trig hscript functions take degrees while the VEX variants take radians fyi.

If you need to add a custom function and you know how to express it in the pseudo-c expression language, you can see this houdini help page:
http://www.sidefx.com/docs/houdini10.0/expressions/_custom [sidefx.com]
You can also directly input expressions in to a parameter field. Omit the function name, wrap everything in curly braces and supply a return type that is supported by the parameter field which is going to be either float or string. I like that once in a while as the houdini custom expression language is sort of like c and you can go pretty far with this and it is quite a lot faster than writing the same thing in Python. Not much help on this in the Houdini docs unfortunately but I can supply a few examples if you wish.

Then there's Python. You can use Python in place of hscript and the custom functions and VEX/VOPs but only if you already are familiar with Python.

You can also build up your function using VOPs/VEX.

If you want an all-in-one solution, you can create your own Python SOP Geometry node and write everything in there. Create your data and put it where ever you want.
See this houdini doc page on that:
http://www.sidefx.com/docs/houdini10.0/hom/cookbook/ [sidefx.com]
and look at the Python SOP examples.
Also search the Side Effects and OdForce forums for other Python SOP examples. There are few real nice examples out there. One in particular is Georg Düemlin Lorenz' circle SOP here:
http://forums.odforce.net/index.php?/topic/6967-a-shader-each-day/page__st__48__p__52733&#entry52733 [forums.odforce.net]
and here
http://www.preset.de/2007/0711/lorenz/ [preset.de]
which is a nice tutorial on how to create a custom Python SOP that creates it's own geometry.

Invariably I will go through all the above steps: First hack some hscript expressions in a Point SOP. If the expressions get too complicated I either choose to write a custom expression, turn to VEX/VOPs or move to Python. Custom Expressions are pretty fast and give you that pseudo-c interface to work in. VEX/VOPs offers a big speed boost if all you need to work on is points as it can be threaded. Python gives you access to primitives which VEX/VOPs doesn't so that tips my hand there.

And if all of that isn't enough, there is CHOPs which stands for Channel Operators. The idea is to use CHOPs as a replacement for the Point SOP where you can reference the geometry with a Geometry CHOP then fetch it back again in to SOPs with a Channel SOP. Have a look at one of my old school blogs here on CHOPs:
http://www.sidefx.com/index.php?option=com_content&task=view&id=1047&Itemid=216 [sidefx.com]
and
http://www.sidefx.com/index.php?option=com_content&task=view&id=573&Itemid=216 [sidefx.com]


Hope the above is helpful to you.
There's at least one school like the old school!
User Avatar
Member
2199 posts
Joined: July 2005
Online
Yeah, that's kinda the longer answer…..
The trick is finding just the right hammer for every screw
  • Quick Links