Hi all, I get the feeling that this is a fairly obvious question, but its never been an issue before. Is there a way to permanently link your textures and you dis maps to your Shaders? I’ve had to move a .hip files between machines and there’s loads of associated file. Do I have to re-link them all manually or is there a faster way?
Regards,
JT
Linked files?
5486 2 2-
- JonT
- Member
- 100 posts
- Joined: 7月 2005
- オフライン
-
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- オフライン
Yes you can but before I answer, I should mention the standard way to reference texture maps: variables. Use variables that reference paths to standard locations for textures. Depending on the facility, you can see a variety of different methods for referencing assets including textures so that many users on different machines can recreate the identical environment and more importantly, make changes and have those shared by others. For example you may see a variable $MAPSTD that points to a location for all the standard maps pointing to a server somewhere in the facility. I have seen 100's of variables set in shells by auto-scripts just to make the session work for the end user.
For single users, use the $JOB environment variable as the base. You could have $JOB/maps/env/sky_blue.rat. After physically moving the directory root to another location, just reset $JOB.
The other variable of interest is $HIP which returns the path to the location of the saved hip file. If you have a map directory in the same location as the .hip file, then using $HIP/map/sky_blue.rat will always work.
$HIP is not editable for obvious reasons but $JOB is. I have to tell you that Houdini inherits all the shell or on Windows system variables. You don't see them in the houdini textport directly (in the variable GUI editor for example) but you can access them directly. Type echo $TEMP and you will get the location of the temp directory. $HOME is yet another very important variable. Given that, there are two main ways to set $JOB (or any inherited variable):
- Set it in the shell or in the Windows system env dialog.
- Set it in Houdini's textport or Aliases/Variables/Expressions GUI dialog accessed in the main menu Settings>Aliases/Variables…
For ease of use for those users new to variables and presumably on windows not using shells, set variables in the Houdini Variables GUI. This variable is then saved with the hip file and makes for a nice localized spot to manage your environment without worrying about shells and sourcing in environments (which is trivial for linux users used to shells but a very different world away for most windows users).
To answer your question. One way to embed images inside the hip file or at least inside the HDA's that are contained in the hip file is to embed the maps in the shaders directly or create a new HDA that simply is a node somewhere in Houdini (object, sop, shop, etc.) that can be referenced by the shaders. The contents of HDA's are referenced using the opdef: syntax.
Let's embed the image directly inside the SHOP and create a new shop in the process. Let's pick on Houdini's default Vop Decal shader (v_decal internal name).
For single users, use the $JOB environment variable as the base. You could have $JOB/maps/env/sky_blue.rat. After physically moving the directory root to another location, just reset $JOB.
The other variable of interest is $HIP which returns the path to the location of the saved hip file. If you have a map directory in the same location as the .hip file, then using $HIP/map/sky_blue.rat will always work.
$HIP is not editable for obvious reasons but $JOB is. I have to tell you that Houdini inherits all the shell or on Windows system variables. You don't see them in the houdini textport directly (in the variable GUI editor for example) but you can access them directly. Type echo $TEMP and you will get the location of the temp directory. $HOME is yet another very important variable. Given that, there are two main ways to set $JOB (or any inherited variable):
- Set it in the shell or in the Windows system env dialog.
- Set it in Houdini's textport or Aliases/Variables/Expressions GUI dialog accessed in the main menu Settings>Aliases/Variables…
For ease of use for those users new to variables and presumably on windows not using shells, set variables in the Houdini Variables GUI. This variable is then saved with the hip file and makes for a nice localized spot to manage your environment without worrying about shells and sourcing in environments (which is trivial for linux users used to shells but a very different world away for most windows users).
To answer your question. One way to embed images inside the hip file or at least inside the HDA's that are contained in the hip file is to embed the maps in the shaders directly or create a new HDA that simply is a node somewhere in Houdini (object, sop, shop, etc.) that can be referenced by the shaders. The contents of HDA's are referenced using the opdef: syntax.
Let's embed the image directly inside the SHOP and create a new shop in the process. Let's pick on Houdini's default Vop Decal shader (v_decal internal name).
- Place a vex decal Shop in the shop directory.
RMB on the icon and select Operator Type Manager…
Create a copy of the default v_decal HDA and put it in the default $HOME location so as not to corrupt the default shipped HDA in Houdini. Do this by RMB on the name and choose copy… and just Accept the default location in your $HOME/houdini7.0/otls/OPcustom.otl. You will be warned that you have an existing copy in the current session. Just press accept. This tells you that all the nodes referencing this HDA will now point at the copied HDA. Fiine.
Now in the Operator Type Manager, the current highlighted shader turns red. This means that it has been superceded by your copied HDA Shop. Just press Latest Definition to find the copied shader.
Now to inject the texture map directly in the HDA. RMB on the new Shop/v_decal listing in the Operator Type Manager and select the Edit Contents… option. A new Edit Contents Dialog pops up.
At the bottom left, press the “+” button and find the map you want to use.
Press the Add File button. Note that the texture map now shows up in the list above followed by an “*” asterix. This means that the file is not yet injected in to the asset. Press the Apply button to inject the texture in to the asset.
Now Press Accept to exit the Edit Contents dialog.
In you shader map string, type in: opdef
Shop/v_decal?sky_blue.rat where sky_blue.rat is the name of the map. Repalce to suit.
The opdef: reference allows you to reference any section (any of the items in the list in the Edit Contents dialog) in any string location in Houdini. You just need to point the opdef: at the Type/HDA_name followed by a ? delimiter and then the name of the section.
Given that, you can create a separate asset that is a placebo (does nothing in a network) but has all kinds of textures injected in to the asset.
Now I showed you the hard-core way of injecting a map in to an asset. A good exercise to see the process directly. There is another much easier way using the Houdini textport: otcontentadd to add files to a given HDA. otcopy to copy one HDA to another HDA.
To inject a map in to v_decal givent that you created a copy of v_decal in $HOME/houdini7.0/otls/OPcustom.otl:
/ -> otcontentadd $HOME/houdini7.0/otls/OPcustom.otl Shop/v_decal /tmp/map/sky_blue.rat
See the help in the textport for more useage info on both otcopy and otcontentadd. I always keep open the Operator Type Manager when I use these commands to get the paths and the HDA names correct. Heaven only knows how many typo's I have made followed by episodes of scratching-head and banging-fist syndrome.
Note
lease note that working with HDA's directly with the Edit Contents dialog from the Operator Type Library Dialog can be lethal to your asset. For example, typing in any errant character in to the DialogScript text may cause no UI to show up. On the other hand, the ability to directly edit the HDA's contents with a text editor is of use to power users.
There's at least one school like the old school!
-
- JonT
- Member
- 100 posts
- Joined: 7月 2005
- オフライン
-
- Quick Links

