Jump to content

Want To Learn Hscripting


Recommended Posts

Hi All

I know its a bad Question :P sorry but i want to ask now i am having some idea in mel scripting

and i am working as full time mel scripting so i want to start houdini .. and i want to learn Hscript

also .. any one can tell me how much similarity is there with mel and Hscript and any resource

which will help me to learn Hscript like some book or some thing .. please help me :)

Thanks and Regards


Link to comment
Share on other sites

Hi Kurian,

Syntax of course is a little bit different but if you familiar with shell scripts a little bit you will find a lot of similarities. I find hscript sometimes very painful to work with especially when it comes to strings manipulations, but for simple stuff is still better for me then python (introduced in H9). When it comes to learning it depends if you have worked with Houdini before. If yes than the most straightforward way would be just to go through Hscript help.


The other one is to start posting to the coders corner,on this forum, where is always someone to help ;)

On the other hand if you are interested with some more complex stuff, I recommend python , starting from the cookbook examples:


Good luck,


PS. You can find quite a lot of useful stuff here, but as far as I remember you need to log in.


Link to comment
Share on other sites

Little confusion with Maya -> Houdini switch is that there are a number of ways of scripting in Houdini, not just hscript, which is among all of them the easiest and least important (it handles work flow not a content). You will catch it very quickly but this has to be clarified.

hscript controls mostly Houdini itself not the content of your scene (well slight simplification is needed sometimes ;) ). It creates nodes, parents them, create channels, copies, works with your OS. Just like a shell scripting, as Kuba mentioned above.

Tricky part are expressions. There are many more of them. They deal with geometries, attributes, channel's samples, pixels... all that stuff. They can by highly sophisticated, they can by stuck with {} creating new expressions, functions etc. I would say thtat the most useful stuff you do in expressions not hscript.

There is also VEX, which is not only shading language but can handle geometry (points and group), pixels or channels's samples in pretty the same way as expressions and it's far far much faster (almost like a C++). Has many advantages (speed!) yet it's not so flexible as expression. You can do many extremely useful stuff with VEX once you get the work flow it implies.

At the end is a HOM with Python binding. Not to much to say. It unifies an usage of hscript and expressions, its robust and powerful. IT IS FULLY OBJECT ORIENTED - not like a python in Maya, which is trivial mapping of methods from MEL. It will be always much slower then VEX when handling geometries yet gives endless possibilities. You can mix Python with hscript and expressions (call hscript in Python) and vice versa. Vex stays aside but this is completely different story.



Edited by SYmek
Link to comment
Share on other sites

I think you should look into Houdini's docs. There are some pages (links from a first page) about VEX.

In short:

VEX - Vector EXpressions. The primary idea for VEX was the RenderMan Shading Language - RSL - which VEX is very similar with. Read about the concept of programmable rendering engines in Internet to grasp that idea. Basically VEX, as RSL, is a very basic yet powerful programming language that describes the properties of surfaces, lights, environments (fog) in rendering stage. It's very similar to plain C and follows most of their conventions.

Now, great thing about VEX is that ,unlike RSL in PRMan, VEX can manipulate not only color, opacity, position (displace) of a surface in Mantra rendering but also point position of geometry inside Houdini, pixel's color in compositions, particles in Houdini's particle engine (POP), samples in animation channeles, or even photons.

For every type of data there is a different, so called, VEX context. All you need to know to start writing VEX shaders and operators is in Docs. Also a number of Houdini's operators are in fact written in VEX. Check for example Mountain SOP or Light, DepthOfField, Retime COPs in compositing, or study shaders that come with Houdini. (RMB on operator -> Type Properties -> Code Tab).

Another great thing about VEX is that you don't have to use code at all. VOPs, one of Houdini's contexts, is a graphical front end to VEX, so using VOPs is yet another way of taking an advantage of VEX.

The last thing that helps in VEX adventures is that almost every concept applicable for PRMan RSL, can be applied also in VEX. So read Pixar's papers from Siggraph, buy PRMan related books, and you will know VEX as well.

Here you have an example I wrote recently to illustrate the similarities:


There could be some problems but this is no more than 1% of RSL shaders.



Edited by SYmek
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.

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