Isotropix Forums

Preserve cast shadows property from houdini to Clarisse

General discussion about the new Angie renderer

Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Fri Apr 29, 2022 7:36 am

Hi !!

We have some models with a diferent geometries. And some of them don't cast shadows (like decals). I know that the cast shadows property depends of the renderer. We would like to export this models from houdini to clarisse using USD format.

Are there any way to pass this propety (cast shadows) into the usd file and make clarisse loads this property automatically?? we are interesting in clarisse 5.5 with Angie

Best
Julio
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby sam » Mon May 02, 2022 6:58 pm

Hi Julio!

Unfortunately there's no real direct way. You'll need export custom attributes in the USD and either read them from a python script or bind expressions to the attributes in Clarisse to read them.
Sam Assadian
Isotropix
CEO/Founder
User avatar
sam
 
Posts: 1857
Joined: Fri Jan 25, 2013 11:33 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Tue May 03, 2022 5:36 am

Hi Sam,

ok. I will do in this way.

Thanks for the quick answer.

Best regards.
Julio
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Thu May 05, 2022 7:41 am

Hi Sam

One question regarding with how to add attributes to a USD file.

Do you know whitch node of houdini we have to use to add attributes into USD? I did some test using the edit properties node in Solaris(houdini). And it seems that the attribute is added. I checked with the usdview. But I can't see the attribute with clarisse.

Best
Julio
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby anemoff » Thu May 05, 2022 4:18 pm

Hi,

Clarisse currently doesn't natively read such properties. I don't know if USD has a native property for "cast shadows" so you might need to export it as a custom property.

If you know what property holds the "cast shadows" value (be it a Houdini native one, or a custom one created by you), you can use the following script to read the specified attribute from all Geometries in a specified Context and apply the read value into Clarisse's "cast_shadows" attribute.

This Python code is not specific to USD. It could be run on any context containing geometries and said property.
You can either run the function directly on a Geometry Object, or on a Context containing Geometries.

python code

def apply_cast_shadows_on_object(geometry, prop_name):
if not geometry or not geometry.is_kindof("Geometry"):
return

# search the property
collection = geometry.get_module().get_properties()
property = None
for i in range(collection.get_property_count()):
if collection.get_property(i).get_name() == prop_name:
property = collection.get_property(i)
break

if property:
# read the property value and apply it if different than the attribute value
resource = property.get_values_property(0)
cast_shadow_prop = bool(resource.get_int(0))
cast_shadow_attr = geometry.attribut_exists("cast_shadows")
if cast_shadow_attr and cast_shadow_prop != cast_shadow_attr.get_bool():
cast_shadow_attr.set_bool(cast_shadow_prop)
else:
ix.log_info("Property '{}' not found in '{}'".format(prop_name, geometry.get_full_name()))

def apply_cast_shadows_on_context(context_path, prop_name):
"""
Searches for all Geometry objects in the specified context, loads and applies the specified
property into the attribute 'cast_shadows'.
"""
context = ix.get_item(context_path)
assert context
geoms = ix.api.OfObjectArray()
context.get_all_objects("Geometry", geoms)
for geom in geoms:
apply_cast_shadows_on_object(geom, prop_name)

# Usage example
apply_cast_shadows_on_context("project://path/to/context", "property_name")


About adding USD properties using Houdini. Maybe you need to prefix the property name with "primvars:" or "userProperties:", preferably "userProperties:" if it's a custom property (i.e. not native to USD).
To check that, open the USD file in USD View, and check the displayed property name. If it doesn't start with the above prefixes, Clarisse will not load them.

Hope this helps.
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 487
Joined: Wed Jan 13, 2016 10:10 am

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Tue May 10, 2022 11:45 am

Hi Anthony,

Thanks for your reply.

I tried to add some primvars: and some custom attributes using houdini wrangle node with VEX with this script:
Code: Select all
usd_addprimvar(0, "/usdexport1", "vrbn_test", "half3");
usd_setprimvar(0, "/usdexport1", "vrbn_test", {1.25, 1.50, 1.75});

usd_addprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "primvars:vrbn_test_bool", "bool");
usd_setprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "primvars:vrbn_test_bool", true);

usd_addprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_primvar", "color3d[]");
usd_setprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_primvar",  vector[](array({1,0,0}, {0,1,0}, {0,0,1})));


and with houdini I can see the primvars:
houdini_usd.PNG
houdini screenshot


Then I exported the file using the USD rop node from houdini. And I loaded the file using the usdedit, I can see this:
Code: Select all
#usda 1.0
(
    defaultPrim = "usdexport1"
    endTimeCode = 1
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 1
    subLayers = [
        @../ac_unit_julio.usd@
    ]
    timeCodesPerSecond = 24
    upAxis = "Y"
)

over "usdexport1"
{
    half3 primvars:vrbn_test = (1.25, 1.5, 1.75)

    over "acUnitVertical_001_default_setNone_LOD_0"
    {
        color3d[] primvars:vrbn_primvar = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
        bool primvars:vrbn_test_bool = 1
    }
}


and if I load the file using the usdview I can see this:
houdini_usd.PNG
houdini screenshot


But If I go to clarisse (5.0 SP8) I can't see any property or primvar on the property editor and neither on the attribute editor. If I execute the code that you propouse me I get this:
Code: Select all
acUnitVertical_001_default_setNone_LOD_0
FBX_paramfacecolor
fbx_rotation
fbx_scale
fbx_translation
MaxHandle
paramedgecolor
paramedgewidth
paramrenderheight
paramrenderwidth
shop_materialpath
st
UDP3DSMAX
Property 'vrbn_test' not found in 'build://project/context1/kk2/acUnitVertical_001_default_setNone_LOD_0'


I also tried to add properties with the "userProperties:", that you mentioned on your reply, but I got the same issue. Do you have any idea why I can't see with Clarisse the primvars that I added??? Maybe this is not the correct workflow to add custom properties with houdini. In this case do you know how I could do it with houdini to add this custom properties and see then in Clarisee?

Best
Julio
Attachments
usdview.png
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby anemoff » Tue May 10, 2022 12:50 pm

The type "half3" is not supported by Clarisse, that's why this one is missing. You can use double3 or float3 instead (I don't know the exact type names in Houdini).
In Clarisse, to debug unsupported properties during load, you can add the option "-log_level Debug" in your command line.
It should print something like:
Code: Select all
[USD] ignoring property 'vrbn_test': type 'half3' isn't supported.

For the property "vrbn_test_bool", I wonder if it's because you created it with the namespace prefix "primvars:".
Houdini documentation says the namespace must not be specified. This is also the only primvar that you created with the namespace.
It doesn't show in UsdView screenshot either, but maybe it's out of the screen.
Can you check that usd_addprimvar doesn't return -1?
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 487
Joined: Wed Jan 13, 2016 10:10 am

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Wed May 11, 2022 11:20 am

Hi Anthony,

I did the changes that you mentioned and it worked right. Now I have this script in houdini

Code: Select all
usd_addprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_test_bool", "bool");
usd_setprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_test_bool", true);

usd_addprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_test_float", "float");
usd_setprimvar(0, "/usdexport1/acUnitVertical_001_default_setNone_LOD_0", "vrbn_test_float", 1.0);


And in clarise I can see the properties on the Property Editor
property_editor.PNG


And with the script that you send me I can read the property.

Thanks a lot!!!! for your help.

BTW I checked all of this in Clarisse 5.0 SP8. With Clarisse 5.5 Early acces it doesn't work. It is just to let you know.

Thanks for all
Julio
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby anemoff » Wed May 11, 2022 11:23 am

Glad to help.
Thanks for the heads up about 5.5.

Edit: I tested in 5.5 EA1 and the script works as expected. Don't hesitate to share the error you got.
Anthony Nemoff
Isotropix
R&D Engineer
User avatar
anemoff
 
Posts: 487
Joined: Wed Jan 13, 2016 10:10 am

Re: Preserve cast shadows property from houdini to Clarisse

Unread postby jucamal23 » Wed May 11, 2022 11:34 am

The scripts works perfectly. The thing is that I can not see the properties vrbn_test_bool and vrbn_test_float on the property editor. I enabled the debug mode on the 5.5 version but no erros when I referenced the usd file.

Best
jucamal23
 
Posts: 6
Joined: Wed Apr 13, 2022 12:17 pm

Next

Return to Angie