Physically based Shaders for Houdini

If you are looking for an alternative to the Houdini 15 physically based shaders, you might want to try PhyShader v1.2.0 by rsd/groundflyer.

https://github.com/groundflyer/physhader-for-mantra
https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=37247

For a quick and easy install just download the zip from git and unpack the “gallery” “vex” and “otls” folders to C:\Users\[USERNAME]\Documents\houdiniXX.X
If you did that right, the material will show up in your material palette.

Give it a go!

[This is a repost of an older post, which I had to delete due to reasons. Also updated the version number. ]

Advertisements

How to access embedded files in HDAs

If you work with Houdini, you eventually get to make HDAs. Then you might want to put all sorts of stuff in there in order to deliver a complete package to the end-user or to put it on Orbolt. You might want to add textures, substances, geometry, other HDAs, etc.

It’s fairly easy to get the files in there:
To attach a file to an HDA:

rightclick on HDA->Type Properties…->Extra Files (TAB)->Filename (from harddrive)->Add File

But the syntax for reading the file out inside the HDA is a little confusing. So here it goes:

opdef:/Network_type/asset_name?section_name

“Network_type” is the context of your HDA (that contains the attachment). If your HDA is a shader, “Network_type” is probably “SHOP”, if your HDA is in obj context, “Network_type” is Object etc. See picture below for a list of possible “Network_type”s.

“asset_name” is the name of your HDA (that contains the attachment).

“section_name” is the name of your attached file with its file extension.

Finally you get something like:

opdef:/Object/My_HDA_v01?pretty.png

 

Also, you can always browse opdef:/ in the “choose file menu”. You can reach this menu via a File parameter.

conext

 

 

The official documentation is also good:

http://www.sidefx.com/docs/houdini/assets/create

QLib Windows installation instructions

QLib is a library of free and useful HDAs for Houdini. Installing it can be a bit tricky, if you don’t have any experience with Git or environment variables.

Here’s my step by step installation guide for Windows:
1. Get and install git:
https://desktop.github.com/

2. In your windows explorer, make a folder with a simple name path (no blanks and no signs, just letters and or numbers) on one of your local harddrives. A structure like: E:\qLib or C:\qLib is perfectly suitable.

The qLib files will be saved here. All your houdini installations can use the same qLib library. When qLib gets updated and or expanded you can update your local version via github and all your dependencies should still work.
When you make an HDA that uses qLib nodes you will have to provide the used qLib nodes with your HDA to make it work on other computers (unless those machines also have qLib installed). Note that it is possible to embed HDAs in each other.

3. Go to:
https://github.com/qLab/qLib

Click on: Clone or download

(That’s the big green button on the top right)

Click on: Open in Desktop

Your browser should suggest to open with GitHub – I tested this with Firefox. Accept.

And select the folder created in step 2. Accept.

GitHub will now download qLib.

3: You should close all your open Houdini programs.

4: In your explorer, go to your equivalent of:
C:\Users\[USERNAME]\Documents\houdini15.5

(Substitute [USERNAME] and Houdini version respectively.) And open houdini.env with a text editor.

5. [EDIT:]
The description for setting up the environment variables (step 5 ) has been updated by the qLib devs. Use the description on the gitHub page insted.

At the bottom of the document add the following 2 lines:
QLIB=E:/qLib/qLib/otls
HOUDINI_OTLSCAN_PATH=@/otls;$QLIB/base;$QLIB/future;$QLIB/experimental

Note: Here the folder created in step 2 was:
E:\qLib

So for something like
C:\derp\aderp\

the first line would have to be
QLIB=C:/derp/aderp/qLib/otls

instead.

6. Start up Houdini. When you press TAB to put down a node, you should notice the qLib category. If you have issue with Houdini after installing qLib, you can remove qLib from Houdini by removing the lines created in step 5.

 

When qLib gets an update (you might want to become friends with them on facebook https://www.facebook.com/qLibHoudini/ to get the news) you can open GitHub, select qLib and press Sync on the top right. Note that you might get issues if you have modified your copies of qLib HDAs. Git should ask you whether you want to keep your changes or use the version of the HDA that is on the server. You might want to copy your changed HDAs to another folder before a sync, just in case.

 

Change shelf height in Maya!

To change the size of your shelf in Maya just use the following mel command:
1. layout -e -height XX ShelfLayout; //replace XX with desired height in pixels

For example, to double the size of the shelf in Maya I had to use:
layout -e -height 100 ShelfLayout;

To make sure the new setting is saved you can:

2. Rightclick on a shelf icon -> Edit,  click Shelves, click Save All Shelves

3. Restart Maya to see the actual result.

increase shelf size maya

After some searching I found the layout command on: http://oshanz.blogspot.nl/2012/08/maya-double-shelf-height-toggle.html , so credit goes there.

Quicktip: Use transparency with Stingray PBS shaders in Maya 2016 ext 2 (Maya 2016.5)

Stingray PBS are the implementation of Physically based real-time shaders in Maya. They are especially useful for previewing game art as it would appear in a modern Engine like Unreal Engine 4 or Unity 5.

To get them to work in a scene, create a new Stingray PBS shader in
Hypershade, or Right click -> Assign New Material
Note: Changing another Material to Stingray PBS via its attributes may cause the Stingray PBS shader to bug out and not initialize properly.

The Stinray PBS shader is fairly straight forward:
The sliders under Attributes change the basic preview values.
To use a texture, assign it under Textures and tick the corresponding box under Attributes. This will override the slider and make the shader use the texture.

If you need transparency:
In Maya 2016 ext2 you can click on the Preset Material drop-down and select preset/Standard_Transparent. This will add a Use Opacity Map tickbox. The shader will use the alpha channel of the color texture when activated.

In earlier versions of Maya, you don’t have this option. But you could add it, because the Stingray PBS shader is actually just a Shader FX network. You can open this network by clicking Open ShaderFX in the material attributes. Click on Make Unique so you don’t edit Maya’s preset, but a unique version of the shader.
Here’s the network for the transparent material:
Shader FX

Nice physically based shader for Houdini 15

Check out PhyShader for Mantra by Roman Saldygashev:

https://github.com/groundflyer/physhader-for-mantra
https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=37247

Installation instruction for Windows 10:
Download the ZIP package from git. Unpack the vex, otls and gallery folders to your equivalent of:
C:\Users\[USER]\Documents\houdiniXX.X

The shader should be in your material palette.

Go check it out!

How to create tools that work based on selected points in Python for Houdini

When creating tools for the Houdini shelf you will usually want the tool to work on your selected nodes and or geometry. Here’s an example code on how you can achieve that:

import toolutils

# http://www.sidefx.com/docs/houdini15.0/hom/hou/GeometrySelection
selection = toolutils.sceneViewer().selectGeometry()
node = selection.nodes()[0]

# http://www.sidefx.com/docs/houdini15.0/hom/hou/GeometrySelection
selection = selection.selectionStrings()

#selection is a tupple
print selection
print type(selection)
selection = list(selection)
print selection[0]
print node

list_of_points = node.geometry().globPoints(selection[0])
print list_of_points

Instructions for testing: Create a python shelf tool with the above code, open a python shell and select some geometry. When you execute the shelf tool you should see the output fromt the print statements in the shell.

Modified from original script created by pelos on the advice of graham:
https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=30272&view=next&sid=c2213c434ff8da4160244efa54586266