How to get usda paths to be absolute no relative

   4397   9   2
User Avatar
Member
642 posts
Joined: Aug. 2013
Offline
Hi. If I save out a usda file using a usdRop my paths are relative so I would not be able to load this file in another package. Does anyone know how you set paths to be absolute instead? Best Mark:

Edit:

OK it's pretty easy, under output processing there is an option that enables to to turn relative paths on and off. It is just on by default. It might make more sense having this off by default. Best Mark
Edited by Mark Wallman - Nov. 3, 2020 05:05:31
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
Hi Mark,

Mark Wallman
If I save out a usda file using a usdRop my paths are relative so I would not be able to load this file in another package.

I would have to dispute this claim… What makes you think that relative paths wouldn't work in other packages? It's possible that there are bugs in the relativizing of paths that Houdini does, but everybody uses the USD library to load USD files, and the USD library has always been perfectly happy with relative paths.

As to the having this on by default, relative paths are almost always a better option than absolute paths because they allow you to relocate your USD files (as long as you copy/move the whole directory) without re-authoring every USD file in the directory.
User Avatar
Member
642 posts
Joined: Aug. 2013
Offline
Hi Mark

Thanks for that. What I am trying to understand is in the example below, how would Maya, Katana etc know where these usd files are to load if I loading this usda file into them. Best


#usda 1.0
(
endTimeCode = 1
framesPerSecond = 24
metersPerUnit = 1
startTimeCode = 1
timeCodesPerSecond = 24
upAxis = “Y”
)

def “rubbleAndCars_mesh” (
kind = “component”
add payload = @./meshes/rubbleAndCars_mesh.usd@</reference1>
)
{
}

def “set_mesh” (
kind = “component”
add payload = @./meshes/set_mesh.usd@</reference1>
)
{
}

def “ivyMan_mesh_01” (
kind = “component”
add payload = @../../../urbanDecay/content/usd/meshes/ivyMan_mesh_01.usd@
)
{
}
User Avatar
Member
260 posts
Joined: March 2011
Offline
mtucker
Hi Mark,

Mark Wallman
If I save out a usda file using a usdRop my paths are relative so I would not be able to load this file in another package.

I would have to dispute this claim… What makes you think that relative paths wouldn't work in other packages? It's possible that there are bugs in the relativizing of paths that Houdini does, but everybody uses the USD library to load USD files, and the USD library has always been perfectly happy with relative paths.

As to the having this on by default, relative paths are almost always a better option than absolute paths because they allow you to relocate your USD files (as long as you copy/move the whole directory) without re-authoring every USD file in the directory.

I couldn´t agree more.

On the same topic, Is It possible to bind textures to the materials using relative paths? (like when using the assign material LOP)
Edited by guilhermecasagrandi - Nov. 3, 2020 10:09:00
User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
guilhermecasagrandi
mtucker
Hi Mark,

Mark Wallman
If I save out a usda file using a usdRop my paths are relative so I would not be able to load this file in another package.

I would have to dispute this claim… What makes you think that relative paths wouldn't work in other packages? It's possible that there are bugs in the relativizing of paths that Houdini does, but everybody uses the USD library to load USD files, and the USD library has always been perfectly happy with relative paths.

As to the having this on by default, relative paths are almost always a better option than absolute paths because they allow you to relocate your USD files (as long as you copy/move the whole directory) without re-authoring every USD file in the directory.

I couldn´t agree more.

On the same topic, Is It possible to bind textures to the materials using relative paths? (like when using the assign material LOP)

I'm pretty sure the output processor handles texture asset paths in the same fashion as layer paths–they will become relative too.
User Avatar
Member
260 posts
Joined: March 2011
Offline
jsmack
guilhermecasagrandi
mtucker
Hi Mark,

Mark Wallman
If I save out a usda file using a usdRop my paths are relative so I would not be able to load this file in another package.

I would have to dispute this claim… What makes you think that relative paths wouldn't work in other packages? It's possible that there are bugs in the relativizing of paths that Houdini does, but everybody uses the USD library to load USD files, and the USD library has always been perfectly happy with relative paths.

As to the having this on by default, relative paths are almost always a better option than absolute paths because they allow you to relocate your USD files (as long as you copy/move the whole directory) without re-authoring every USD file in the directory.

I couldn´t agree more.

On the same topic, Is It possible to bind textures to the materials using relative paths? (like when using the assign material LOP)

I'm pretty sure the output processor handles texture asset paths in the same fashion as layer paths–they will become relative too.

But when we use the assign material, the binds are done before the output processors and the conversion have already been done.
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
Mark Wallman
What I am trying to understand is in the example below, how would Maya, Katana etc know where these usd files are to load if I loading this usda file into them.

Relative paths within a USD file are always relative to the directory containing the USD file doing the referencing. This is true for referencing/sublayering/payloading additional USD files, and for referring to textures, volumes, or other external file types.

Just to be explicit, if the file in your example is at /home/user/projects/myproject/assets/usd/file.usd,
add payload = @./meshes/rubbleAndCars_mesh.usd@
Will load /home/user/projects/myproject/assets/usd/meshes/rubbleAndCars_mesh.usd

add payload = @./meshes/set_mesh.usd@</reference1>
Will load /home/user/projects/myproject/assets/usd/meshes/set_mesh.usd

add payload = @../../../urbanDecay/content/usd/meshes/ivyMan_mesh_01.usd@
Will load /home/user/projects/urbanDecay/content/usd/meshes/ivyMan_mesh_01.usd

Hope that helps!
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
guilhermecasagrandi
But when we use the assign material, the binds are done before the output processors and the conversion have already been done.

Which conversions have already been done?

In general, I would recommend authoring all paths to all USD files and other assets within a LOP network as full paths. Then let the USD ROP's output processor sort everything out and generate the correct relative paths when saving the USD files.

If you author relative paths to texture files in your LOP network, those paths have to be authored relative to the “current working directory” (i.e. the directory you were in when you launched Houdini). This is a fragile way to specify paths.

Using $HIP or $JOB or $SITE prefixes on your paths is good practice because they get converted to full paths (the env vars get expanded when evaluating the parameters), but also save the user a lot of typing. I won't claim to know when $HIP is better or worse than $JOB. I'm sure there are people around with war stories about that. But they are both good in the sense that they get expanded to full paths, so the USD ROP can convert them back to proper relative paths (relative to each USD file being written out to disk, even if those USD files are going into multiple different directories).
User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
mtucker
guilhermecasagrandi
But when we use the assign material, the binds are done before the output processors and the conversion have already been done.

Which conversions have already been done?

In general, I would recommend authoring all paths to all USD files and other assets within a LOP network as full paths. Then let the USD ROP's output processor sort everything out and generate the correct relative paths when saving the USD files.

If you author relative paths to texture files in your LOP network, those paths have to be authored relative to the “current working directory” (i.e. the directory you were in when you launched Houdini). This is a fragile way to specify paths.

Using $HIP or $JOB or $SITE prefixes on your paths is good practice because they get converted to full paths (the env vars get expanded when evaluating the parameters), but also save the user a lot of typing. I won't claim to know when $HIP is better or worse than $JOB. I'm sure there are people around with war stories about that. But they are both good in the sense that they get expanded to full paths, so the USD ROP can convert them back to proper relative paths (relative to each USD file being written out to disk, even if those USD files are going into multiple different directories).

Does this mean outputprocessors do handle texture asset paths?
User Avatar
Staff
4435 posts
Joined: July 2005
Offline
jsmack
Does this mean outputprocessors do handle texture asset paths?

Yep.
  • Quick Links